Python 库,可读取任何大小的 JSON 文件。
Python library that reads JSON files of any size.
The magic is in the Array and Object types. They load stuff from the file only when necessary.
The library expects files to be opened in binary mode.
The file size in this example is 78 GB.
import bigjson
with open('wikidata-latest-all.json', 'rb') as f:
j = bigjson.load(f)
element = j[4]
print(element['type'])
print(element['id'])pytest-3 .暂无开放 Issues,或尚未同步最近议题。