【Python 练习实例100】列表转换为字典。
1 2 3 4 5 6 |
list_key = ['a','b','c','d','e'] list_value = [1,2,3,4,5] dict = {} for i in range(len(list_key)): dict[list_key[i]] = list_value[i] print(dict) |
输出:
1 |
{'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5} |