我正在尝试在python中读取json文件但无法执行此操作。我的json文件大小为436mb,我使用的是python 3.3.4版本 试过不同的方式
import json
from pprint import pprint
with open('drug-event-0002-of-0002.json') as data_file:
data = json.load(data_file)
print(data)
Error :
Traceback (most recent call last):
File "C:/Users/533335/Desktop/jsonReadTest.py", line 6, in <module>
print(data)
File "C:\Python33\lib\idlelib\PyShell.py", line 1339, in write
return self.shell.write(s, self.tags)
MemoryError
---------------------------------------------------------------------
import ijson
with open('drug-event-0002-of-0002.json', 'r') as f:
parser = ijson.parse(f)
for prefix, event, value in parser:
if prefix == "name":
print(value)
Error :
Traceback (most recent call last):
File "C:/Users/533335/Desktop/jsonReadTest.py", line 1, in <module>
import ijson
ImportError: No module named 'ijson'