diff options
| author | Senthil Kumaran <senthil@uthcode.com> | 2011-07-17 17:32:06 +0800 |
|---|---|---|
| committer | Senthil Kumaran <senthil@uthcode.com> | 2011-07-17 17:32:06 +0800 |
| commit | 364e58e9c693ff4e8b00e85234136824d8d4768a (patch) | |
| tree | 41b0e0b1031d44139e7728ab900509e26a692126 /Doc/tutorial/stdlib2.rst | |
| parent | 2b007f596431d4a4275f3ad23a1c9974793c781c (diff) | |
| parent | e229e3591b5e3245582a023c669b3c46ee156d39 (diff) | |
| download | cpython-364e58e9c693ff4e8b00e85234136824d8d4768a.tar.gz | |
merge from 3.2
Diffstat (limited to 'Doc/tutorial/stdlib2.rst')
| -rw-r--r-- | Doc/tutorial/stdlib2.rst | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Doc/tutorial/stdlib2.rst b/Doc/tutorial/stdlib2.rst index fe7f027b53..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 @@ -271,7 +273,7 @@ applications include caching objects that are expensive to create:: Traceback (most recent call last): File "<stdin>", line 1, in <module> d['primary'] # entry was automatically removed - File "C:/python31/lib/weakref.py", line 46, in __getitem__ + File "C:/python33/lib/weakref.py", line 46, in __getitem__ o = self.data[key]() KeyError: 'primary' |
