__init__.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:unsonic 作者: redshodan 项目源码 文件源码
def toDict(self, body):
        root = xmltodict.parse(body, attr_prefix="")

        def walker(d):
            if not isinstance(d, list) and not isinstance(d, OrderedDict):
                return
            for key, val in d.items():
                if isinstance(val, list):
                    for val2 in val:
                        walker(val2)
                elif isinstance(val, OrderedDict):
                    walker(val)
                elif val is None:
                    d[key] = OrderedDict()
                elif val == "false":
                    d[key] = False
                elif val == "true":
                    d[key] = True

        walker(root)
        return root
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号