This blog post is 17 years old! Most likely, its content is outdated. Especially if it's technical.
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.
- Previous:
- Deep sea fish, lots of pictures 11 March 2004
- Next:
- To readline() or readlines() 12 March 2004
- Related by category:
-
How much faster is Redis at storing a blob of JSON compared to PostgreSQL? 28 September 2019 Python
- Best practice with retries with requests 19 April 2017 Python
- Fastest way to find out if a file exists in S3 (with boto3) 16 June 2017 Python
- Interesting float/int casting in Python 25 April 2006 Python
- Fastest way to unzip a zip file in Python
31 January 2018 Python
- Related by keyword:
- Unzip benchmark on AWS EC2 c3.large vs c4.large 29 November 2017
- A neat trick to zip a git repo with a version number 01 September 2017