![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
喜欢海贼路飞
骷髅的旗帜,是信念的象征!
展开
-
python json.dumps和json.loads
json.dumps python对象转为json字符串 l = [1,2,'abc',{'name':'zhangsan','age':'99'}] #把这样一个python对象转化成json字符串 json.dumps(l) =>'[1,2,"abc",{"age":"99","name":"zhangsan"}]' #可以看到经过这样一个转化,原本的数据还是发生了变化。 d = {'b':None,'a':5,'c':'zxc'} json.dumps(d) => '{"a"原创 2021-03-12 11:19:32 · 271 阅读 · 0 评论 -
python 获取的json字符串取值
获取到的json字符串,然后对其取值 {u'result': {u'10.10.10.100': {u'status': u'OK', u'msg': u"{'listen': {'': set([]), '25': set([]), '22': set(['10.9.19.148', '10.10.10.1', '10.10.10.130'])}}"}}} data = result.g...原创 2018-11-14 11:36:48 · 9883 阅读 · 0 评论 -
python 字典的构建
传统的文字表达式 >>> d={'name':'Allen','age':21,'gender':'male'} >>> d {'age': 21, 'name': 'Allen', 'gender': 'male'} 动态分配键值 >>> d={} >>> d['name']='Allen' >&...原创 2018-11-14 15:00:34 · 464 阅读 · 0 评论