Python – zip archive example

from zipfile import *

with ZipFile(‘test.zip’, ‘w’) as zf:
      zf.write(‘abc.txt’)
      zf.write(’emp.txt’)

# Extracting files from archive

with ZipFile(‘test.zip’, ‘r’) as zf:

       zf.extractall(‘f:\demo’)

Published by Python programming examples for beginners

Abhay Gadkari is an IT professional having around experience of 20+ years in IT industry. He worked on web technologies and databases with Insurance and ERP projects.