import json
dic = {
         'str': 'this is a string',
         'list': [1, 2, 'a', 'b'],
         'sub_dic': {
                       'sub_str': 'this is sub str',
                       'sub_list': [1, 2, 3]
                     },
         'end': 'end'
       }
a = json.dumps(dic)
print a

输出结果: {"sub_dic": {"sub_str": "this is sub str", "sub_list": [1, 2, 3]}, "end": "end", "list": [1, 2, "a", "b"], "str": "this is a string"}

 keys = ['ne_id','attached','name','devid','dev_zone_name']
values  = ['ne_id','attached','name','devid','dev_zone_name']

dict(zip(self.keys, values))

将两列list组成一个dict

相关文章:

  • 2022-12-23
  • 2022-01-02
  • 2021-08-18
  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-23
  • 2021-09-15
  • 2021-11-04
相关资源
相似解决方案