Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def read_chunks(filename, mode="r", chunk_size=32):
- with open(filename, mode) as f:
- while True:
- data = f.read(chunk_size)
- if not data:
- break
- yield data
- def main():
- filename = "/Users/bob.smith/files/really_really_big.dat"
- for chunk in read_chunks(filename):
- print(chunk)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement