python3精要(51)-json
生活随笔
收集整理的這篇文章主要介紹了
python3精要(51)-json
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
import json
x=[1,"張三",17,"長(zhǎng)跑"]
z=json.dumps([1, 'simple', 'list'])
print(z)
with open("test.txt","w") as f:json.dump(x, f)
with open("test.txt") as f:y = json.load(f)
print(y)
[1, “simple”, “l(fā)ist”]
[1, ‘張三’, 17, ‘長(zhǎng)跑’]
總結(jié)
以上是生活随笔為你收集整理的python3精要(51)-json的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: mxnet基础到提高(36)-单层神经网
- 下一篇: python3精要(51)--抛出异常与