-1

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

jasger
  • 3
  • 2
  • 3
    Does this answer your question? [How to get an absolute file path in Python](https://stackoverflow.com/questions/51520/how-to-get-an-absolute-file-path-in-python) – BrokenBenchmark Mar 19 '22 at 20:49

1 Answers1

0

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())
Hoxha Alban
  • 1,042
  • 1
  • 8
  • 12