json_Processor.py 文件源码

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

项目:x-path-walker 作者: Lompik 项目源码 文件源码
def get_path_line_number(self, path, with_attrs=False):
        path = path.split("| ")[1] if (with_attrs is True) else path

        orig = self.parsed
        path = get_dict_from_path(path, self.separator)
        res = traverse_and_remove_path(orig, path)
        orig = json.dumps(orig, indent=4).split("\n")

        if(len(orig) != self.file_line_number):
            raise ValueError("This json file formatting is not compatible. Please run `python -m json.tool file`")

        with_del = json.dumps(res, indent=4).split("\n")
        return(list_compare_idx(orig, with_del) + 1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号