1
I’m learning how to find directories in Python and came across the following code:
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
print(dir_path)
cwd = os.getcwd()
print(cwd)
Why in the python language is used __file__
to refer to the current file?
How this command relates to all syntax?
What’s the downside of using os.getcwd()
?
They’re not the same.
– Renan Gomes