Possible Duplicates:
when is it necessary to add anelse
clause to a try..except in Python?
Python try-else
for arg in sys.argv[1:]:
try:
f = open(arg, 'r')
except IOError:
print 'cannot open', arg
else:
print arg, 'has', len(f.readlines()), 'lines'
f.close()
What is usage of this else clause, and when will it be executed?