将两个list列表对象转为dict字典对象
代码示例
keys = ['one', 'two', 'three']
values = [1, 2, 3]
dct = dict(zip(keys, values))
print(dct)
# {'one': 1, 'two': 2, 'three': 3}
参考文章
- Python。将 2 个列表转换为一个字典对象 [重复]
微信扫一扫
将两个list列表对象转为dict字典对象
代码示例
keys = ['one', 'two', 'three']
values = [1, 2, 3]
dct = dict(zip(keys, values))
print(dct)
# {'one': 1, 'two': 2, 'three': 3}
参考文章
相关推荐