File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -811,13 +811,13 @@ are always available. They are listed here in alphabetical order.
811
811
See also :ref: `typeiter `.
812
812
813
813
One useful application of the second form of :func: `iter ` is to build a
814
- block-reader. For example, reading fixed-width blocks from a text file
815
- until the end of file is reached:
814
+ block-reader. For example, reading fixed-width blocks from a binary
815
+ database file until the end of file is reached: :
816
816
817
- from functools import partial
818
- with open('mydata.txt' ) as fp :
819
- for block in iter(partial(fp .read, 64), ''):
820
- process_block(block)
817
+ from functools import partial
818
+ with open('mydata.db', 'rb' ) as f :
819
+ for block in iter(partial(f .read, 64), ''):
820
+ process_block(block)
821
821
822
822
823
823
.. function :: len(s)
You can’t perform that action at this time.
0 commit comments