Sending multiple .CSV files to .ZIP without storing to disk in Python
I'm working on a reporting application for my Django powered website. I want to run several reports and have each report generate a .csv file in memory that can be downloaded in batch as a .zip. I would like to do this without storing any files to disk. So far, to generate a single .csv file, I am following the common operation: mem_file = StringIO.StringIO() writer = csv.writer(mem_file) writer.writerow(["My content", my_value]) mem_file.seek(0) response = HttpResponse(mem_file, content_type='text/csv') response['Content-Disposition'] = 'attachment; filename=my_file.csv' This works fine, but