import csv
import json
json_reader = open("name.json", encoding='utf-8')
json_reader = json.load(json_reader)["result"]
csv_reader=csv.reader(open('Sheet.csv',encoding='utf-8'))
new_row_1 = []
for row in csv_reader:
if row[4] in json_reader.keys():
new_row = row[4:7]
new_row.append(json_reader[row[4]])
new_row_1.append(new_row)
print(new_row_1)
with open('newwrite.csv', 'w', newline='') as csv_file:
csv_write = csv.writer(csv_file,dialect='excel')
csv_write.writerows(new_row_1)
json csv 读取写入
最新推荐文章于 2024-04-02 14:18:01 发布