def add(a=3,b):
print a,b
add(4)
这样写的话,运行的话就会报错:SyntaxError: non-default argument follows default argument
意思就是默认赋值的参数必须在没有赋值的参数的后面
def add(a,b=3),函数这样定义的话下面调用的时候就不会报错了。
这也是在学习的过程中没有注意到的,在使用中才发现有这么一个坑。