Mobile version of this pagePython UnZipped
http://www.devshed.com/c/a/Python/Python-UnZipped/zipping, unzipping, winzip, zipfile, zip, devshed, dev shed
11th of March 2004
Zipping and unzipping a file in Python is child-play. It can't get much easier than this. Well, in Windows you can highlight a couple of files and right-click and select from the WinZip menu. Here's how to do it in Python:
>>> import zipfile
>>> zip = zipfile.ZipFile('Python.zip', 'w')
>>> zip.write('file1.txt')
>>> zip.write('file2.gif')
>>> zip.close()
>>> zip = zipfile.ZipFile('Python.zip', 'w')
>>> zip.write('file1.txt')
>>> zip.write('file2.gif')
>>> zip.close()
Still confused? Read this article for Dev Shed then. The article includes some more advanced uses as well.







Save this page in del.icio.us