Re: stringio+tarfile (or better... zipfile)

2009-07-03 Thread Gabriel Genellina
En Fri, 03 Jul 2009 17:14:22 -0300, superpollo escribió: following the excellent suggestions received, i tried to adapt the problem to zipfile, and i wrote this: zip = zipfile.ZipFile(zb , "w" , zipfile.ZIP_DEFLATED) for name , buffer in [nb1 , nb2]: zip.writestr(name, buffer.getvalue()

Re: stringio+tarfile (or better... zipfile)

2009-07-03 Thread superpollo
following the excellent suggestions received, i tried to adapt the problem to zipfile, and i wrote this: $ cat zip001.py import sys import zipfile import StringIO nb1 = "first.txt", StringIO.StringIO("one one\n") nb2 = "second.txt", StringIO.StringIO("two\n") zb = StringIO.StringIO() zip = zip