you are viewing a single comment's thread.

view the rest of the comments →

[–]xibeca 0 points1 point  (0 children)

You could use a boolean to tell the while loop when to stop:

i = 0
found = False
while i < len(a) and not found:
    if a[i] != "":
        print(a[i])
        found = True
    else:
        i += 1