Message280924
https://docs.python.org/3.5/tutorial/errors.html
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()
Although IOError is still available as an alias to OSError, it should not be used in the tutorial, I believe. |
|
Date |
User |
Action |
Args |
2016-11-16 07:37:22 | dmiyakawa | set | recipients:
+ dmiyakawa, docs@python |
2016-11-16 07:37:22 | dmiyakawa | set | messageid: <1479281842.16.0.362729785805.issue28713@psf.upfronthosting.co.za> |
2016-11-16 07:37:22 | dmiyakawa | link | issue28713 messages |
2016-11-16 07:37:21 | dmiyakawa | create | |
|