|
|
|
|
|
by johndough
1996 days ago
|
|
Works fine with Python's standard library. Files in a ZipFile can be read in a streaming manner. There is no need to store all the data in memory. import io, csv, zipfile
max_lines = 10
with zipfile.ZipFile("data.zip") as z:
for info in z.infolist():
with z.open(info.filename) as f:
reader = csv.reader(io.TextIOWrapper(f))
for i_line, line in enumerate(reader):
if i_line >= max_lines: break
print(line)
|
|