model(**inputs)备忘

参考:----------链接----------

dict1 = {
        'x': 1,
        'y': 2,
        'z': 3
    }

 正确用法:

def mytest(x, y, z):
    print("x: {}".format(x))
    print("y: {}".format(y))
    print("z: {}".format(z))
mytest(**dict1)

# x: 1
# y: 2
# z: 3

错误用法:

def mytest(x, y, m):
    print("x: {}".format(x))
    print("y: {}".format(y))
    print("m: {}".format(m))
mytest(**dict1)

# TypeError: mytest() got an unexpected keyword argument 'z'

猜你喜欢

转载自blog.csdn.net/sdaujz/article/details/112642226