Handle more file closing with "with"

This commit is contained in:
Ville Skyttä
2016-07-07 18:53:34 +03:00
parent 593708a39c
commit e8a8be5788
6 changed files with 17 additions and 33 deletions

View File

@@ -223,11 +223,8 @@ def main(argv):
print("Checking %s..." % fn)
try:
f = open(fn, 'rb')
try:
with open(fn, 'rb') as f:
lines = list(f)
finally:
f.close()
except (IOError, OSError) as err:
print("%s: cannot open: %s" % (fn, err))
num += 1