mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
Use with statement where it improves the documentation (closes #10461)
This commit is contained in:
parent
17b880a5d6
commit
a3dd56b6cf
5 changed files with 16 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue