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

how to compare variables from api call, and the condition is met but it still not giving any output or error, program completes

我想在 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 传递的,但即使满足条件,它也不会给出任何输出或错误,只是完成程序。

您的条件测试 appbranchbranch 是否相等。由于您在 appbranch 前面放置了 space,这似乎不太可能:

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

除非 branch 也以 space?

开头