Directory
In python the command to get the current working directory is in the os module (os.path module) you can use the __file__ constant if a file has been used.
If not already imported type
import os
you can then use the os.getcwd() command by typing in
os.getcwd()
To return "the canonical path of the specified filename, eliminating any symbolic links encountered in the path" type
os.path.realpath(path)
To return "the directory name of pathname path" type
os.path.dirname(path)
To return "a string representing the current working directory" type
os.getcwd()
To change the current working directory use
os.chdir(path)
To use the __file__ constant a file must have been used, else an not defined error.
PATH EXAMPLES
import os
print("Path at terminal when executing this file")
print(os.getcwd() + "\n")
print("This file path, relative to os.getcwd()")
print(__file__ + "\n")
print("This file full path (following symlinks)")
full_path = os.path.realpath(__file__)
print(full_path + "\n")
print("This file directory and name")
path, filename = os.path.split(full_path)
print(path + ' --> ' + filename + "\n")
print("This file directory only")
print(os.path.dirname(full_path))