def gen(text):
try:
for line in text:
try:
yield int(line)
except:
# Ignore blank lines - but catch too much!
pass
finally:
print('Doing important cleanup')
text = ['1', '', '2', '', '3']
if any(n > 1 for n in gen(text)):
print('Found a number')
print('Oops, no cleanup.')
ZGVmIGdlbih0ZXh0KToKICAgIHRyeToKICAgICAgICBmb3IgbGluZSBpbiB0ZXh0OgogICAgICAgICAgICB0cnk6CiAgICAgICAgICAgICAgICB5aWVsZCBpbnQobGluZSkKICAgICAgICAgICAgZXhjZXB0OgogICAgICAgICAgICAgICAgIyBJZ25vcmUgYmxhbmsgbGluZXMgLSBidXQgY2F0Y2ggdG9vIG11Y2ghCiAgICAgICAgICAgICAgICBwYXNzCiAgICBmaW5hbGx5OgogICAgICAgIHByaW50KCdEb2luZyBpbXBvcnRhbnQgY2xlYW51cCcpCgp0ZXh0ID0gWycxJywgJycsICcyJywgJycsICczJ10KCmlmIGFueShuID4gMSBmb3IgbiBpbiBnZW4odGV4dCkpOgogICAgcHJpbnQoJ0ZvdW5kIGEgbnVtYmVyJykKCnByaW50KCdPb3BzLCBubyBjbGVhbnVwLicp