113

参数-匿名函数-生成式-生成器-装饰器-归来仍少年-51CTO博客

 6 years ago
source link: http://blog.51cto.com/shaoniana/2066657
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
1、函数的参数参数类型:关于函数的参数,我们经常在一些代码中会发现def(args,*kwargs)的表现形式,其中定义的分别是元组和字典:*args——tuple(1,)**kwargs——dict(“k”:“v”)例如:fun(*args,**kwargs)fun(1,2,3,4,5,a=10,b=40)我们也可以简单的定义一个函数的参数:defadd(*args):total=0foriin

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK