카테고리 없음

[Python] ijson으로 열리지 않는 파일 열기

SweetDev 2023. 5. 28. 18:50
import ijson
import json
with open(filePath, 'r') as json_file:
    print('hello')
    data = ijson.items(json_file, 'item')
    papers = (o for o in data)
    pp= []
    index = 0
    for p in papers:
        with open(writePath, 'w') as f:
            json.dump(p, f, ensure_ascii=False)
        index += 1