如何比较api调用中的变量,并且满足条件,但仍然没有给出任何输出或错误,程序完成

时间:2019-02-21 02:53:07

标签: python python-2.7 jython-2.7

我想在if条件中引用两个变量

def remedialIssue(self, branch, issue_id, new_status):
    AppBranch = request.get("/rest/api/latest/issue/" + str(issue_id), params=querystring, contentType='application/json')
    appbranch = json.loads(AppBranch.response)
    appbranch = u" {0}".format(appbranch['fields']['customfield_1000'])
    appbranch = str(appbranch)
    branch = str(branch)
    print(appbranch)
    print(branch)
    if appbranch == branch:
        print "error"

从外部应用程序GUI传递分支,该应用程序GUI调用此函数,但是即使满足条件,它也不会给出任何输出或错误,只需完成程序即可。

1 个答案:

答案 0 :(得分:0)

您的条件测试表明appbranchbranch相等。由于您要在appbranch前面放置一个空格,因此这似乎不太可能:

u" {0}".format(...)

除非branch也以空格开头?