Pandas version :0.19.2
System version :Windows 10
# write to file
import json
file_path='./dic1.json'
dic1 = {'list1':[1,2,3,4]}
dic1
with open(file_path, 'w') as f:
json.dump(dic1, f)
# read from file
import json
file_path='./dic1.json'
with open(file_path) as f:
dic2 = json.load(f)
list2=dic2['list1']
list2
執行結果:``` [1, 2, 3, 4] ```
沒有留言:
張貼留言