标签:结果 结构 ESS list pre 元组 nbsp 列表 dict
将二维结构[[‘a‘,1],[‘b‘,2]]和((‘x‘,3),(‘y‘,4))转换成字典
list1 = [[‘a‘,1],[‘b‘,2]] tuple1 = ((‘x‘,3),(‘y‘,4)) dict1 = dict(list1) dict2 = dict(tuple1) print(dict1,dict2)
输出结果:
{‘a‘: 1, ‘b‘: 2} {‘x‘: 3, ‘y‘: 4} Process finished with exit code 0
标签:结果 结构 ESS list pre 元组 nbsp 列表 dict
原文地址:https://www.cnblogs.com/hrv5/p/12006031.html