我在 python 中抓取资源,我想制作一个 json 文件,在 Openrefine 中使用它来清理数据。
这是我的代码:
import json
import codecs
A = xpath
B = xpath
C = xpath
D = xpath
with codecs.open('info2.json', 'a', 'utf-8-sig') as f:
json.dump({'A': A, 'B': B, 'C': C, 'D': D}, f, sort_keys=True, indent=4, ensure_ascii=False)
没关系,直到我将文件上传到 Openrefine 中:我无法单击正确的节点,而只能单击特定元素。这是一个例子:
我认为使用 python 生成 json 时出错,我尝试放置两个 {{}} 但它给了我一个“dict”错误,所以我尝试将元素放入数组但没有任何效果。
作为请求,这里是 json 的一部分:
ps 我正在使用编解码器,因为有非拉丁字符