diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-09-03 19:52:03 (GMT) |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-09-03 19:52:03 (GMT) |
commit | 7dde792e62c8adeaf5d633dc89e18d16067add8e (patch) | |
tree | 41852c7a810c87d0a804d19f7ba6bc4266b1d66c /Lib/turtle.py | |
parent | 24e561ae0473ad6f46709e38ed8ebc97d89fc55e (diff) | |
download | cpython-7dde792e62c8adeaf5d633dc89e18d16067add8e.zip cpython-7dde792e62c8adeaf5d633dc89e18d16067add8e.tar.gz cpython-7dde792e62c8adeaf5d633dc89e18d16067add8e.tar.bz2 |
Use a context manager for some file objects.
Diffstat (limited to 'Lib/turtle.py')
-rw-r--r-- | Lib/turtle.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/turtle.py b/Lib/turtle.py index 6f06059..5185f3c 100644 --- a/Lib/turtle.py +++ b/Lib/turtle.py @@ -169,9 +169,8 @@ _CFG = {"width" : 0.5, # Screen def config_dict(filename): """Convert content of config-file into dictionary.""" - f = open(filename, "r") - cfglines = f.readlines() - f.close() + with open(filename, "r") as f: + cfglines = f.readlines() cfgdict = {} for line in cfglines: line = line.strip() |