Print directory where file is saved with Python
<p>how could do print the path directory of my file saved with python.
For ad example, i start with idle3 (Fedora 24), i save the IDLE code on: /home/jetson/Desktop/Python/Programs and in the code is written:</p>

<pre><code>f = open("Hello.txt","w")
f.write("This is a test","\n")
f.close()
</code></pre>

<p>My question is: after f.close i would print the directory grabbed with </p>

<pre><code>import sys.os 

print("The file is saved in ",direcotrysaved)
</code></pre>

<p>It's possible?</p>

<p>You can use <code>os.getcwd()</code> for getting the current working directory:</p>

<pre><code>import os

os.getcwd()
</code></pre>

<p>Otherwise, you could also specify the full path for the file when opening it, e.g.</p>

<pre><code>f.open('/path/to/the/folder/Hello.txt', 'w')
</code></pre>

python python-3.x