I am writing a basic program to compress data from text_file,but it gave an error
import gzip
with gzip.open('gzip.txt','rb') as f:
power_ = f.read()
print(power_)
Traceback (most recent call last):
File "c:/Users/Nikhil/Desktop/file_sys_pr/gzip_module.py", line 11, in <module>
power_ = f.read()
File "C:\Users\Nikhil\AppData\Local\Programs\Python\Python37-32\lib\gzip.py", line 276, in read
return self._buffer.read(size)
File "C:\Users\Nikhil\AppData\Local\Programs\Python\Python37-32\lib\gzip.py", line 463, in read
if not self._read_gzip_header():
File "C:\Users\Nikhil\AppData\Local\Programs\Python\Python37-32\lib\gzip.py", line 411, in _read_gzip_header
raise OSError('Not a gzipped file (%r)' % magic)
OSError: Not a gzipped file (b'po')
Encountered this error