stringio+tarfile

superpollo user at example.net
Thu Jul 2 16:57:49 EDT 2009


why the following does not work? can you help me correct (if possible)?

       1 import tarfile
       2 import StringIO
       3 sf1 = StringIO.StringIO("one\n")
       4 sf2 = StringIO.StringIO("two\n")
       5 tf = StringIO.StringIO()
       6 tar = tarfile.open(tf , "w")
       7 for name in [sf1 , sf2]:
       8     tar.add(name)
       9 print tf
      10 sf1.close()
      11 sf2.close()
      12 tf.close()
      13 tar.close()

tia



More information about the Python-list mailing list