位置参数
调用函数时根据函数定义的参数位置来传递参数。
# 位置参数
def test_param_type1(user,nickname):
print("user is %s ,his nickname is %s"%(user,nickname))
if __name__ == '__main__':
# 位置参数测试
test_param_type1("名字","昵称")
输出:
user is 名字 ,his nickna
调用函数时根据函数定义的参数位置来传递参数。
# 位置参数
def test_param_type1(user,nickname):
print("user is %s ,his nickname is %s"%(user,nickname))
if __name__ == '__main__':
# 位置参数测试
test_param_type1("名字","昵称")
输出:
user is 名字 ,his nickna