函数中强制关键字传参

def test(*, a, b):
    print("%s, %s" % (a, b))


# test(1, 2)

test(a=1, b=2)

第五行代码是错误的,必须使用关键字传参形式

猜你喜欢

转载自www.cnblogs.com/chenliang0309/p/10390463.html
今日推荐