一行代码合并两个字典

dic_1 = {'a':111,'b':222}
dic_2 = {'c':333,'d':444}
dic = {**dic_1,**dic_2}
print(dic)
# {'a': 111, 'b': 222, 'c': 333, 'd': 444}
{**字典名,**字典名2} 进行合并字典


2020-05-07

posted @ 2020-05-07 19:43  CodeYaSuo  阅读(220)  评论(0编辑  收藏  举报