[英]Writing JSON data to file in python
我不太確定如何編寫JSON
所以請您幫我,我正在嘗試使用python
JSON
實現此功能。 這是偽代碼
binary_students = json(students)
write_to_the_file_system(binary_students)
我不太了解,有人可以幫我嗎。
您可以使用字典來存儲Json數據,如下所示:
>>> dict = {'Student1':'x1','Student2':'x2'}
然后使用json
庫
>>> import json
>>> with open('data.txt', 'w') as outfile:
json.dump(dict,outfile)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.