即使我正在为其分配值,也不会使用局部变量'result'的值,可以告诉为什么未使用'result'的原因

时间:2019-04-30 01:58:05

标签: python-3.x

即使我正在为其分配值,我的结果变量仍未使用,可以告诉为什么“结果”未使用

def caught_speeding(speed, is_birthday):
    if speed in range(0, 61):
        result = 0
    elif speed in range(61, 81):
        if is_birthday == True:
            result = 0
        else:
            result = 1

    elif speed >= 81:
        if is_birthday == True:
            result = 0
        else:
            result = 2
    else:
        result = None

caught_speeding(60, False)
caught_speeding(65, False)
caught_speeding(65, True)

1 个答案:

答案 0 :(得分:0)

修改以返回结果:

os.system('C:/mybackup/imageautomation/Etl.PrepareAttachments.exe')                       
'''I want the above exe to run and after completion close itself and 
then run the exe in the below command'''
os.system('C:/mybackup/imageautomation/Etl.UploadAttachments.exe')