python字典做入参调用时要写成**K这种形式

字典做入参调用和定义的时候都要写成**k这种形式

def try_dic(**dic):
    for key,value in dic.items():
        print(key,":",value)


if __name__=="__main__":
    dic = {}
    dic["a"] = "b"
    dic["b"] = "c"
    try_dic(**dic)

输出

a : b
b : c
原文地址:https://www.cnblogs.com/mghhzAnne/p/14139649.html