万里长征第一步,读取amazon11G的json文件, 找了很多方法ijson等等等之后,发现只要按行读取就好了,然后通过json.loads(line)将json字符串转为字典即可
1 import json 2 3 filename = 'Electronics.json' 4 5 with open(filename) as file_object: 6 for line in file_object: 7 print(line) 8 numbers = json.loads(line) 9 print(numbers['overall'])