commit | 2f50aaf2ff427fb713e82699a6dcbeeb038b10c2 | [log] [tgz] |
---|---|---|
author | Giampaolo Rodola' <g.rodola@gmail.com> | Tue Feb 12 02:04:27 2013 +0100 |
committer | Giampaolo Rodola' <g.rodola@gmail.com> | Tue Feb 12 02:04:27 2013 +0100 |
tree | 0e2c24897b8918f19d8504915ccebd466c0bbd92 | |
parent | fd6e6cfa29b2289e711dc7f57f36897c78899ee7 [diff] [blame] |
modernize some modules' code by using with statement around open()
diff --git a/Lib/site.py b/Lib/site.py index 732e1c4..acaeb3e 100644 --- a/Lib/site.py +++ b/Lib/site.py
@@ -384,9 +384,8 @@ 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