Sunday, October 5, 2025
HomeLanguagesgzip.decompress(s) in Python

gzip.decompress(s) in Python

With the help of gzip.decompress(s) method, we can decompress the compressed bytes of string into original string by using gzip.decompress(s) method.

Syntax : gzip.decompress(string)
Return : Return decompressed string.

Example #1 :
In this example we can see that by using gzip.decompress(s) method, we are able to decompress the compressed string in the byte format of string by using this method.




# import gzip and decompress
import gzip
s = b'This is GFG author, and final year student.'
s = gzip.compress(s)
  
# using gzip.decompress(s) method
t = gzip.decompress(s)
print(t)


Output :

b’This is GFG author, and final year student.’

Example #2 :




# import gzip and compress
import gzip
s = b'GeeksForGeeks@12345678'
s = gzip.compress(s)
  
# using gzip.decompress(s) method
t = gzip.decompress(s)
print(t)


Output :

b’GeeksForGeeks@12345678′

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32337 POSTS0 COMMENTS
Milvus
86 POSTS0 COMMENTS
Nango Kala
6706 POSTS0 COMMENTS
Nicole Veronica
11871 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11936 POSTS0 COMMENTS
Shaida Kate Naidoo
6823 POSTS0 COMMENTS
Ted Musemwa
7089 POSTS0 COMMENTS
Thapelo Manthata
6779 POSTS0 COMMENTS
Umr Jansen
6779 POSTS0 COMMENTS