我在所有可能的组合中使用了 .format 和 %s 命令,但没有任何进展。 当我这样使用它时它工作正常:
last_issue = jira.search_issues('assignee = "ahmet" order by created desc')[0]
但是我需要受让人成为一个变量,如果我以这种方式使用它或类似的东西:
assignee = "ahmet"
last_issue = jira.search_issues('assignee =', assignee, 'order by created desc')[0]
它给出了类似的错误
response headers = {'Vary': 'User-Agent', 'X-AREQUESTID': '578x1623860x1', 'X-ASESSIONID': 'x0ubjs', 'X-ASEN': 'SEN-L0000000', 'Cache-Control': 'no-cache, no-store, no-transform', 'X-Content-Type-Options': 'nosniff', 'X-AUSERNAME': 'ekaterina', 'X-Seraph-LoginReason': 'OK', 'Content-Encoding': 'gzip', 'Transfer-Encoding': 'chunked', 'Date': 'Mon, 11 Sep 2017 09:38:10 GMT', 'Content-Type': 'text/html;charset=UTF-8', 'Server': 'nginx/1.13.0', 'Connection': 'keep-alive'}
response text =
我应该如何以适当的方式创建变量?
最佳答案
它有效!
var = "assignee = '{}' order by created desc".format(assignee)
last_issue = jira.search_issues(var)[0]
关于python - 如何在python中将变量插入mysql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46152550/