list1=[('a',1),('b',5),('c',3)]
list2=[('a',2),('b',2)]
hash = {}
for i,k in list1+list2:
if i not in hash:
hash[i] = k
elif k >= hash[i]:
hash[i] = k
list3 = hash.items()
print(list3)
这样吗随便写的
list1=[('a',1),('b',5),('c',3)]
list2=[('a',2),('b',2)]
hash = {}
for i,k in list1+list2:
if i not in hash:
hash[i] = k
elif k >= hash[i]:
hash[i] = k
list3 = hash.items()
print(list3)
这样吗随便写的