1.两个列表变成键值对关系
list1 = ['name','sex','address','age']
list2 = ['huahua','boy','chengdu',23]
dict1={}
for i in range(0,len(list1)):
for j in range(0,len(list2)):
if i == j:
dict1[list1[i]] = list2[j]
print(dict1)
2.map
遍历序列,对序列中每个元素进行操作,最终获取新的序列
map(func, *iterables) --> map object
new_map = map(lambda a: a + 100, range(10))
new_enum = enumerate(new_map,1)
new_dic = dict(new_enum)
print(new_dic.items())