1 ответ
+ 2
You don't even need to use the OS module for that. You can just use the default 'open()' function and type in the file name:
open("file.gz", 'w')
Disclaimer: I don't use Python that often, so I could be wrong. And if something is binary, you'll want to open it in binary mode: open("file.gz", 'b')