[Python-es] zipfile Buffered

Juan de Dios Manjón Pérez juande en jdmanjon.net
Vie Ene 21 14:10:51 CET 2011


He estado googleando 
http://www.google.com/search?q=python+zipfile+stream+raw como leer y 
escribir en un zip usando streams o raw

Busco algo parecido a este ejemplo: (solo como muestra)


BUFFER_SIZE = io.DEFAULT_BUFFER_SIZE¶

zin =zipfile.ZipFile('archive.zip','r')

|zout =zipfile.ZipFile('archve_new.zip','w')

foritem inzin.infolist():
     reader =zin.BufferedReader(item.filename,| BUFFER_SIZE|)
     writer = zout.BufferedWriter(||item.filename|, BUFFER_SIZE)

chuck = reader.read(BUFFER_SIZE)
while chuck:
      writer.write(chuck)
      chuck = reader.read(BUFFER_SIZE)

reader.close()
writer.close()

|)
zout.close()
zin.close()
|



Saludos
Juande
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://mail.python.org/pipermail/python-es/attachments/20110121/5cde7996/attachment.html>


Más información sobre la lista de distribución Python-es