json

import json
str=['abb',456,True,False]
# json_str=json.dumps(str)
# with open ('test.json','w') as f:
#     f.write(json_str)
#
with open ('test.json','w') as f:
    json.dump(str,f)


# with open ('test.json','r') as f:
#     res=f.read()
#     json_res=json.loads(res)
#     print(json_res)
#     print(type(json_res))
with open('test.json','r') as f:
    res=json.load(f)
    print(res)
    print(type(res))
json

 

posted @ 2021-02-20 01:33  丑矬穷屌  阅读(9)  评论(0编辑  收藏  举报