Python json.loads shows ValueError: Extra data

后端 未结 9 893
甜味超标
甜味超标 2020-11-22 16:21

I am getting some data from a JSON file \"new.json\", and I want to filter some data and store it into a new JSON file. Here is my code:

import json
with ope         


        
9条回答
  •  一生所求
    2020-11-22 16:41

    One-liner for your problem:

    data = [json.loads(line) for line in open('tweets.json', 'r')]
    

提交回复
热议问题