标签:abc 字典 zip 转换 python 列表 new bsp pytho
一、列表转字典:
方法1:
list_1 = [‘abc‘, ‘efg‘]
list_2 = [123, 456]
new_dict = dict(zip(list_1, list_2))
方法2:
list_1 = [‘a‘, 1]
list_2 = [‘b‘, 2]
list_3 = [list_1, list_2]
new_dict = dict(list_3)
二、字典转列表:
dict_1 = {‘a‘, 1}
list_keys = list(dict_1)
list_values = list(dict_1.values)
标签:abc 字典 zip 转换 python 列表 new bsp pytho
原文地址:https://www.cnblogs.com/crazyaugustmoon/p/10189681.html