Directory structure inside a ZipFile object
Scott David Daniels
Scott.Daniels at Acm.Org
Thu Dec 9 10:42:57 EST 2004
More information about the Python-list mailing list
Thu Dec 9 10:42:57 EST 2004
- Previous message (by thread): Directory structure inside a ZipFile object
- Next message (by thread): Directory structure inside a ZipFile object
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Bulba! wrote:
> tried to read file, zip it, and put in the target directory....
>
> It works nice, except the zipfile created contains the directory path
> of the source file -- which I do NOT want to recreate.
Look into the two-argument form of the write command:
import zipfile
archive = zipfile.ZipFile('box.zip', 'w', zipfile.ZIP_DEFLATED)
archive.write('source/somewhere/one.txt', 'name.txt')
archive.write('two.txt', 'another.txt')
archive.close()
--Scott David Daniels
Scott.Daniels at Acm.Org
- Previous message (by thread): Directory structure inside a ZipFile object
- Next message (by thread): Directory structure inside a ZipFile object
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list