Python 字典生成:将两个列表转换为键值对
list1 = [1001, 1002, 1003, 1004] list2 = ['Tom', 'Jerry', 'Spike', 'Tyke']
dictionary = {} for i in range(len(list1)): dictionary[list1[i]] = list2[i]
print(dictionary)
原文地址: https://www.cveoy.top/t/topic/mIdV 著作权归作者所有。请勿转载和采集!