我想用不均匀的列来写行。以下是我的代码:
import csv
import json
path = 'E:/Thesis/thesis_get_data'
outputfile = open('maplight_113.csv', 'w', newline='')
outputwriter = csv.writer(outputfile)
with open (path + "/" + 'maplight data 113congress.json',"r") as f:
data = json.load(f)
for bill in data['bills']:
b = bill.get('measure')
for organization in bill['organizations']:
d = organization.get('name')
f = organization.get('disposition')
a = (organization.get('catcode'))
outputwriter.writerow([b, d, a, f])
outputfile.flush();
每”比尔。得到在我的数据中,('measure')”可能有一组或多组“d,f,a”,from“bill['organizations']”与之关联。我希望每一组“d,f,a”都要在同一列中填充其他列比尔。得到('measure')”行。在
这个怎么样?在
您需要:
^{pr2}$相关问题 更多 >
编程相关推荐