我网上查出来的txt转json的代码,当然自己还改编过了。目前代码、txt文件和错误如下。import json
book = 'C:\\Users\\wt271\\Desktop\\jc\\passenger.txt'
book_list = []
with open(book) as b:
book_list = b.read().splitlines()
data = dict(book_list)
print(data)
j = json.dumps(data)
print(j)
添加回答
举报
0/150
提交
取消