参数
必需参数
def printme( str ):
"打印任何传入的字符串"
print (str)
return
# 调用 printme 函数,不加参数会报错
printme()Traceback (most recent call last):
File "test.py", line 10, in <module>
printme()
TypeError: printme() missing 1 required positional argument: 'str'关键字参数
默认参数
不定长参数
语法
加星号*的参数
加两个星号**的参数
强制位置参数
最后更新于