/ Published in: Python

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
f = open('test.zip', 'rb') for data in iter( lambda: f.read(1024) , ''): pass # do stuff # or without lambda f = open('really_big_file.dat') def read1k(): return f.read(1024) for piece in iter(read1k, ''): process_data(piece)
URL: http://stackoverflow.com/questions/519633/lazy-method-for-reading-big-file-in-python
Comments
