def func1(name, age, sex, *args): ''' 打印姓名,年龄,性别 ''' print(name) print(age) print(sex) # func1('python', 28,sex='man','s','23') ## 工作经验:不定长参数都是放到最后 func1(name='python', age=30, sex='nv') help(func1) # def func1(a,b, c=100,*args,**kwargs): # print(a) # print(b) # print(c) # print(args) # print(kwargs) # 不定长参数可以不接收值 # func1(10, 20, c=200) # c是第三个位置,能接收第三个数据 # func1(10, 20, 300) # func1(10, 20, 30, 40,50,60,name='python') # 下一行报错:一个参数c只能接收一个值:这里是c接收了30和100 # func1(10,20,30,50,60, c=100,name='python')