[英]Python Tkinter SyntaxError: non-keyword arg after keyword arg
[英]“SyntaxError: non-keyword arg after keyword arg” Error in Python when using requests.post()
response = requests.post("http://api.bf3stats.com/pc/player/", data = player, opt)
在python IDLE中运行此行以测试事物后,我遇到语法错误:关键字arg之后为非关键字arg。
不知道这是怎么回事。
player
和opt
是包含一个单词字符串的变量。
尝试:
response = requests.post("http://api.bf3stats.com/pc/player/", opt, data=player)
您不能在关键字参数之后放置非关键字参数。
有关更多信息,请访问http://docs.python.org/2.7/tutorial/controlflow.html?highlight=keyword%20args#keyword-arguments上的文档。
应该是这样的:
response = requests.post("http://api.bf3stats.com/pc/player/", data=player, options=opt)
因为您不能在关键字参数( data=player
)之后传递非关键字参数( opt
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.