lzma.LZMACompressor() in Python
Last Updated :
26 Mar, 2020
With the help of lzma.LZMACompressor()
method, we can get compressor to compress the bytes of string by using lzma.LZMACompressor()
method.
Syntax : lzma.LZMACompressor()
Return : Return compressed string.
Example #1 :
In this example we can see that by using lzma.LZMACompressor()
method, we are able to compress the string in the byte format by using this method.
import lzma
s = b 'This is GFG author, and final year student.'
print ( len (s))
compressor = lzma.LZMACompressor()
t = compressor.compress(s)
print ( len (t))
|
Output :
43
24
Example #2 :
import lzma
s = b 'GeeksForGeeks@12345678'
print ( len (s))
compressor = lzma.LZMACompressor()
t = compressor.compress(s)
print ( len (t))
|
Output :
22
24
Share your thoughts in the comments
Please Login to comment...