如何在python中扫描返回值?

时间:2013-06-26 17:14:47

标签: python

!/ usr / bin / env python

导入系统 导入ToBuildOrNot

repoArray = [“MSS_sims”,“PCS_CCS”]

def main(argv):     repoArray中的repo:

    needsBuild = ToBuildOrNot.ToBuildOrNot(repo)

    if needsBuild == True:
        print "\n",repo,"Needs To rebuilt\n"
        print "---------------------------------------------------------------"

    elif needsBuild == False:
        print "\n", repo,"does NOT Need to be Rebuilt\n"
        print "---------------------------------------------------------------"

    else:
        print "error"

如果名称 =='主要':     主(sys.argv中[1:])

1 个答案:

答案 0 :(得分:0)

使用==进行相等性检查而非isis用于身份检查。

if needsBuild == True:
    print "The MSS_sims Needs To rebuilt"

elif needsBuild == False:
    print "The MSS_sims does NOT Need to be Rebuilt"

else:
    print "error

相关:Is there a difference between `==` and `is` in Python?