I want to print out the path of a file I created with open() in python 3.10.
The code I wrote to create the file:
file = open('genericName.name', 'wb')
file.write('some text')
file.close()
Thanks in advance
I want to print out the path of a file I created with open() in python 3.10.
The code I wrote to create the file:
file = open('genericName.name', 'wb')
file.write('some text')
file.close()
Thanks in advance
Unless otherwise specified files are created in the current working directory, you can find this value thanks to the os
module:
import os
print(os.getcwd())