标签:一个 字符串 dict 生成 value get 字符 col 合并
a = [
‘a,1‘,
‘b,3,22‘,
‘c,3,4‘,
]
b = [
‘a,2‘,
‘b,1‘,
‘d,5‘,
]
c=[‘a,1,2‘, ‘b,3,22,1‘, ‘c,3,4‘, ‘5‘]
dic=dict([(i[0],i) for i in a]) print(dic) # 组成元组形式,然后生成字典形式 for v in b: if dic.get(v[0]): dic[v[0]]=dic[v[0]]+v[1:] else: dic[v[0]]=v[2:] print(list(dic.values()))
标签:一个 字符串 dict 生成 value get 字符 col 合并
原文地址:https://www.cnblogs.com/one-tom/p/11661430.html