def hello_key(greeting='hello', name='world'): print('%s, %s' % (greeting, name)) hello_key() hello_key(greeting='panzidong')
result:
hello, world
panzidong, world
关键参数的厉害地方在于可以在函数中提供默认参数
def hello_key(greeting='hello', name='world'): print('%s, %s' % (greeting, name)) hello_key() hello_key(greeting='panzidong')
result:
hello, world
panzidong, world
关键参数的厉害地方在于可以在函数中提供默认参数