Fix Python – TypeError: ‘str’ does not support the buffer interface

plaintext = input(“Please enter the text you want to compress”)
filename = input(“Please enter the desired filename”)
with gzip.open(filename + “.gz”, “wb”) as outfile:
outfile.write(plaintext)

The above python code is giving me following error:
Traceback (most recent call last):
File “C:/Users/Ankur Gupta/Desktop/Python_works/gzip_work1.p….