當前位置:成語大全網 - 新華字典 - python 把壹個字典key的值加到另壹個字典的key的值中?

python 把壹個字典key的值加到另壹個字典的key的值中?

import openpyxl

a = {'A': [2136, 1888, 2102, 1911, 1966], 'B': [123, 698, 2564]}

b = {'A': [2136, 1695, 2102, 1888]}

for key in a.keys():

for bkey in b.keys():

if bkey == key:

for i in b[bkey]:

a[key].append(i)

print(a)

格式如上,註意對齊