From a3dd56b6cffaeee21fec6529b212fd4fa98c1ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Fri, 11 Mar 2011 17:42:48 +0100 Subject: Use with statement where it improves the documentation (closes #10461) --- Doc/tutorial/stdlib2.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Doc/tutorial/stdlib2.rst') diff --git a/Doc/tutorial/stdlib2.rst b/Doc/tutorial/stdlib2.rst index 603f143aa0..85c88dc23f 100644 --- a/Doc/tutorial/stdlib2.rst +++ b/Doc/tutorial/stdlib2.rst @@ -141,7 +141,9 @@ standard size and in little-endian byte order:: import struct - data = open('myfile.zip', 'rb').read() + with open('myfile.zip', 'rb') as f: + data = f.read() + start = 0 for i in range(3): # show the first 3 file headers start += 14 -- cgit v1.2.1