Data compression with Python and the LZW algorithm
With the help of this code, you can reduce the size of html and xml text files by up to 90% !
import main
x= main.Encoding()
x.load('a.txt')
x.compress()
x.save('ac')import main
x= main.Decoding()
x.load('ac')
x.decompress()
x.save('a.txt')x = main.Encoding()
i = x.compressing_informations()The original file size, the compressed file size and the compressed percentage return to the dictionary.
x = main.Decoding()
v = x.valid("a.txt" , 'ac')Returns True if the compressed file is equal to the original file.
The installation file and images are in this repository. This file is a beta version that will eventually compress 1.2 MB text files.
.png)