Python zipfile writestr method. How to write large string ? (a large CSV file)

112 Views Asked by At

Possible Duplicate:
Create a zip file from a generator in Python?

from zipfile import ZipFile

with ZipFile('spam.zip', 'w') as myzip:
     myzip.writestr('file.csv','records1,fields')

The above code works for creating a zip file. But I want to generate a large csv file with thousands of records. With the above code we can not append string to file 'file.csv' and I don't want to create large string in memory before writing to myzip.

Is there a way to append string to file.csv dynamically?

0

There are 0 best solutions below