python按照数据格式存储和解析
使用json
import json
my_array = [
{1: 1, 2: 2, '3': 3},
{'gvkuerhghnrti': 12312, 'fwejfw': {1: 1}},
]
with open('123.json', 'w') as f:
json.dump(my_array, f)
with open('123.json', 'r') as f:
res = json.load(f)
print res
python按照数据格式存储和解析
使用json
import json
my_array = [
{1: 1, 2: 2, '3': 3},
{'gvkuerhghnrti': 12312, 'fwejfw': {1: 1}},
]
with open('123.json', 'w') as f:
json.dump(my_array, f)
with open('123.json', 'r') as f:
res = json.load(f)
print res