summaryrefslogtreecommitdiffstats
path: root/Lib/turtle.py
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2010-09-03 19:52:03 (GMT)
committerFlorent Xicluna <florent.xicluna@gmail.com>2010-09-03 19:52:03 (GMT)
commit7dde792e62c8adeaf5d633dc89e18d16067add8e (patch)
tree41852c7a810c87d0a804d19f7ba6bc4266b1d66c /Lib/turtle.py
parent24e561ae0473ad6f46709e38ed8ebc97d89fc55e (diff)
downloadcpython-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.py5
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()