1 >>> def add_and_maybe_multiply(a,b,c=None): 2 result = a+b 3 if c is not None: 4 result = result*c 5 return result 6 7 >>> add_and_maybe_multiply(2,3,' ')#实参为空格,返回空格 8 ' ' 9 >>> add_and_maybe_multiply(2,3,'')#实参为空,返回为空 10 '' 11 >>> add_and_maybe_multiply(2,3,4) 12 20 13 >>> add_and_maybe_multiply(2,3)#实参缺失,返回line2的结果 14 5