question on the OS module of python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

question on the OS module of python

If I want to create a file with the OS module in python that has a different expansion, like .gz(google zip), how can I do it?

26th Apr 2019, 11:36 PM
P1NBALL72
P1NBALL72 - avatar
1 Answer
+ 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')
27th Apr 2019, 5:25 AM
Zeke Williams
Zeke Williams - avatar