Compress and decompress string in Python

0 votes
Please write a program to compress and decompress the string. Which module should be used?
Jul 23, 2019 in Python by Ritu

1 answer to this question.

0 votes

You can use the zlib module available in python to compress and decompress the string. Refer to the code below:

import zlib
text="Hello world"
print("Compressed: ", comp)
print("Decompressed: ", decomp)
answered Jul 23, 2019 by Bhagavath

Related Questions In Python

0 votes
1 answer

How can I print variable and string on same line in Python?

Use , to separate strings and variables while printing: print ...READ MORE

answered Sep 17, 2018 in Python by Priyaj
• 57,550 points
0 votes
1 answer

Is it possible to print a string and a variable in a single print statement in Python?

This can be done using simple string ...READ MORE

answered Jul 15, 2019 in Python by Neel
• 3,010 points
+1 vote
1 answer
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,218 views
0 votes
0 answers
+4 votes
6 answers
+1 vote
1 answer

Python: Print variable and string in same line

For a better understanding you can refer ...READ MORE

answered Oct 30, 2018 in Python by Priyaj
• 57,550 points
0 votes
1 answer

Replace First and Last Word of String in the Most Pythonic Way

import re a = " this is a ...READ MORE

answered Aug 22, 2018 in Python by aryya
• 7,370 points