modernize some modules' code by using with statement around open()

This commit is contained in:
Giampaolo Rodola' 2013-02-12 02:04:27 +01:00
parent fd6e6cfa29
commit 2f50aaf2ff
14 changed files with 50 additions and 89 deletions

View file

@ -384,9 +384,8 @@ class _Printer(object):
for filename in self.__files:
filename = os.path.join(dir, filename)
try:
fp = open(filename, "r")
data = fp.read()
fp.close()
with open(filename, "r") as fp:
data = fp.read()
break
except OSError:
pass