调用的函数输出的结果是两个字典,这两个字典怎么合并??

调用的函数输出的结果是两个字典,这两个字典怎么合并??

问题描述:

def main() :
    while True :
        menu()
        choice = int(input('请选择'))
        l1 = {}
        l2 = {}
        if choice in [0,1] :
            if choice == 0 :
                l1 = file1()
            elif choice == 1 :
                l2 = file2()
                return
                dict(l1,**l2)
                print(dict)

def main() :
    while True :
        menu()
        choice = int(input('请选择'))
        l1 = {}
        l2 = {}
        if choice in [0,1] :
            if choice == 0 :
                l1 = file1()
            elif choice == 1 :
                l2 = file2()
                return
        l1.update(l2)   
        print(l1)
      

l1.update(l2)