If one IF is satisfied, skip the rest in the nest...

bigred04bd3 at gmail.com bigred04bd3 at gmail.com
Wed Oct 21 13:31:04 EDT 2015


So here what I have, I have a 3 IF's within the same level.  If one IF is satisfied, I would like to "skip" the other IFs and continue with my code.

# 4 second open
            if wb1_sheet1.cell(row=cell + 1, column=2).value == 0 and wb1_sheet1.cell(row=cell + 1, column=3).value == 0 and wb1_sheet1.cell(row=cell + 2, column=2).value == 0 and wb1_sheet1.cell(row=cell + 2, column=3).value == 0 and wb1_sheet1.cell(row=cell + 3, column=2).value == 0 and wb1_sheet1.cell(row=cell + 3, column=3).value == 0:
                open += 3
                open_seconds += 4
                start = wb1_sheet1.cell(row=cell + 4, column=2).coordinate
                break
            # 3 second open
            if wb1_sheet1.cell(row=cell + 1, column=2).value == 0 and wb1_sheet1.cell(row=cell + 1, column=3).value == 0 and wb1_sheet1.cell(row=cell + 2, column=2).value == 0 and wb1_sheet1.cell(row=cell + 2, column=3).value == 0:
                open += 3
                start = wb1_sheet1.cell(row=cell + 3, column=2).coordinate
                open_seconds += 3
                continue
            # 2 second open
            if wb1_sheet1.cell(row=cell + 1, column=2).value == 0 and wb1_sheet1               .cell(row=cell + 1, column=3).value == 0:
                open += 3
                start = wb1_sheet1.cell(row=cell + 2, column=2).coordinate
                open_seconds += 2


if any but the last IF is true, then all IFs will be true...that's my problem.

any help would be great



More information about the Python-list mailing list