python gzip file

import gzip
f_in = open('https://cdn.myedukit.com/home/joe/file.txt')
f_out = gzip.open('https://cdn.myedukit.com/home/joe/file.txt.gz', 'wb')
f_out.writelines(f_in)
f_out.close()
f_in.close()

Here is what the above code is Doing:
1. Open the input file for reading.
2. Open the output file for writing in binary mode.
3. Copy the contents of the input file to the output file.
4. Close both files.