2018年3月23日

dict字典与str字符串互转

摘要: 一、字符串str转为字典dict 方式1 a = '{"a":"1", "b":"1"}' b = eval(a) print(type(b)) >>>class 'dict' 方式2,转换后赋值给 b a = '{"a":"1", "b":"1"}' exec('b='+a) print(type 阅读全文

posted @ 2018-03-23 12:04 Haha.chen 阅读(45918) 评论(2) 推荐(0)

导航