标签:group 一个 int width color ring 相关 ble 分享
Python
|
JSON
|
dict
|
object
|
list, tuple
|
array
|
str, unicode
|
string
|
int, long, float
|
number
|
True
|
true
|
False
|
false
|
None
|
null
|
#例子1:把Python的dict格式转换成json字符串格式 import json a = dict(name = ‘Yangling‘,age = 28,message = ‘you are so cool‘) print(a) print(type(a)) b = json.dumps(a) print(b) print(type(b)) #例子2: c = json.loads(b) print(type(c)) print((c)) print(c[‘name‘])
1 jsondata = ‘{\"a\":1,\"b\":2,\"c\":3,\"d\":4,\"e\":5}‘ 2 with open(‘a.txt‘,‘w‘) as f: 3 json.dump(jsondata,f) 4 5 with open(‘a.txt‘,‘r‘) as fr: 6 m = json.load(fr) 7 print(m) 8 print(type(m))
标签:group 一个 int width color ring 相关 ble 分享
原文地址:http://www.cnblogs.com/yangjinbiao/p/7828125.html