json写入和读取代码

#写入new文件
import  json
dic = {'name':'alex'}
i = 8
s = 'hello'
l = [11,22]
f = open("new_hello","w")
date = json.dumps(dic)
f.write(date)
#读取信息
f_read = open("new_hello","r")
data = json.loads(f_read.read())
print(data)

 

posted @ 2016-12-13 15:55  打不死的--蟑螂  阅读(211)  评论(0编辑  收藏  举报