Directory structure inside a ZipFile object

Bulba! bulba at bulba.com
Thu Dec 9 16:14:41 EST 2004


On Thu, 09 Dec 2004 07:42:57 -0800, Scott David Daniels
<Scott.Daniels at Acm.Org> wrote:

>Look into the two-argument form of the write command:

Well, I should have guessed that, it works. Thanks!


>     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



--
It's a man's life in a Python Programming Association.



More information about the Python-list mailing list