沉铝汤的破站

IS LIFE ALWAYS THIS HARD, OR IS IT JUST WHEN YOU'RE A KID

JSONの初见

0x01 json.dump()和json.load()


json.dump存储

import json

numbers = [1,2,3,4,5]

filename = 'num.json'
with open(filename, 'w') as f_ob:
    json.dump(numbers, f_ob)

json.load()读取

import json

filename = 'num.json'
with open(filename) as f_ob:
    numbers = json.load(f_ob)
print(numbers)

…书上的好像就没了,以后遇到了再加