title: Sending multiple .CSV files to .ZIP without storing to disk in Python
body: <p>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:</p>
  
  <pre><code>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'
  </code></pre>
  
  <p>This works fine, but only for a single, unzipped .csv. If I had, for example, a list of .csv files created with a StringIO stream:</p>
  
  <pre><code>firstFile = StringIO.StringIO()
  # write some data to the file
  
  secondFile = StringIO.StringIO()
  # write some data to the file
  
  thirdFile = StringIO.StringIO()
  # write some data to the file
  
  myFiles = [firstFile, secondFile, thirdFile]
  </code></pre>
  
  <p>How could I return a compressed file that contains all objects in <code>myFiles</code> and can be properly unzipped to reveal three .csv files? </p>