函數中強制關鍵字傳參

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


# test(1, 2)

test(a=1, b=2)

第五行代碼是錯誤的,必須使用關鍵字傳參形式

相關文章
相關標籤/搜索