If I have a file test.py that resides in some directory, how can I find out from test.py what directory it is in? os.path.curdir will
test.py
os.path.curdir
Here's how to get the directory of the current file:
import os os.path.abspath(os.path.dirname(__file__))