Python – Data Compression:

In this tutorial, we will learn about the data compression in Python programming language. In python, the data can be archived, compressed using the modules like zlib, gzip, bz2,lzma,zipfile and tarfile.

To use the respective module, you need to import the module first. Let us look at below example.

Example: