时间:2021-07-01 10:21:17 帮助过:54人阅读
# 将两个字典合并 #!/usr/bin/python def adddict(dict1,dict2): xin = {} for key in dict1.keys(): xin[key] = dict1[key] for key in dict2.keys(): xin[key] = dict2[key] return xin s1 = {1:222,'c':'d','e':'f'} s2 = {2:333,'g':'h','i':'j'} print adddict(s1,s2)
希望本文所述对大家的Python程序设计有所帮助。