我在网站上看到了以下示例
import throttle
def some_fun(uid):
if not throttle.check(key=uid, rate=30, size=10):
raise ThrottleError()
但是我在这里没有得到uid的意思吗?
答案 0 :(得分:1)
uid
不是关键字或变量,它称为Parameter
,它们在函数名称后的括号内指定。您可以根据需要添加任意多个参数,只需用逗号分隔即可。
$ cat nfunc.py
#!/python/v3.6.1/bin/python3
def my_function( headers):
print(headers + " Gusain")
my_function("Jungi")
my_function("Arjun")
my_function("Kirpal")
$ ./nfunc.py
Jungi Gusain
Arjun Gusain
Kirpal Gusain
请检查Here有关python functions
的信息。