# -*- coding: utf-8 -*- def hello(greeting='hello', name='world!'): print '%s,%s' % (greeting, name) hello() hello('I like you') def hello1(name, greeting='hello', punctuation='!'): print '%s, %s%s' % (name, greeting, punctuation) hello1('world') 当设置函数时如果参数具有默认值,那么调用的时候就可以不用提供参数。