昨天上午在码农网学到的,挺实用的一个函数!
a=[“z”,“x”,“c”,“v”,“b”,“n”,“m”]
b = [“a”,“s”,“d”,“f”,“g”,“h”,“j”]
new_list_tup = zip(a,b)
#print(list(new_list_tup)) #[(‘z’, ‘a’), (‘x’, ‘s’), (‘c’, ‘d’), (‘v’, ‘f’), (‘b’, ‘g’), (‘n’, ‘h’), (‘m’, ‘j’)]
new_dic = dict(new_list_tup)
print(new_dic)