Python UnZipped

11 March 2004   0 comments   Python

http://www.devshed.com/c/a/Python/Python-UnZipped/

Mind That Age!

This blog post is 13 years old! Most likely, its content is outdated. Especially if it's technical.

Powered by Fusion×

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()

Still confused? Read this article for "Dev Shed"n:http://www.devshed.com/ then. The article includes some more advanced uses as well.

Follow @peterbe on Twitter

Comments

Thank you for posting a comment

Your email will never ever be published


Related posts

Previous:
Deep sea fish, lots of pictures 11 March 2004
Next:
To readline() or readlines() 12 March 2004
Related by Keyword:
A neat trick to zip a git repo with a version number 01 September 2017
Related by Text:
A neat trick to zip a git repo with a version number 01 September 2017
Parrot; CLR for the poor man 06 November 2003
Concurrent Gzip in Python 13 October 2017
Comparing Ruby and PHP 21 September 2006
Case study where Python was the final choice 03 December 2003