📅  最后修改于: 2022-03-11 14:47:19.302000             🧑  作者: Mango
def read_file(path, block_size=1024):
with open(path, 'rb') as f:
while True:
piece = f.read(block_size)
if piece:
yield piece
else:
return
for piece in read_file(path):
process_piece(piece)