ie.py 文件源码

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

项目:comp 作者: McSinyx 项目源码 文件源码
def json_extract_info(filename):
    """Return list of entries extracted from a file using json. If an
    error occur during the extraction, return None.
    """
    try:
        if not isfile(filename):
            filename = urlretrieve(filename)[0]
        with open(filename) as f: raw_info, info = json.load(f), []
        for i in raw_info:
            e = DEFAULT_ENTRY.copy()
            for k in e:
                if k in i and isinstance(i[k], type(e[k])): e[k] = i[k]
            info.append(e)
    except:
        return None
    else:
        return info
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号