import os
dir_path = os.path.dirname(os.path.realpath(__file__))
import os
#full path
dir_path = os.path.dirname(os.path.realpath(__file__))
#current dir
cwd = os.getcwd()
import os
print(os.path.abspath(''))
import os
os.path.abspath(__file__) # Directory of current python script
#Output will look something like: C:UsersUserNameDesktoppy-script.py
from os import getcwd # only import "getcwd" from os
getcwd() # Get the current working directory
import os
your_file_path = "D:yourdirpathfile.csv"
print(f"Dir:{os.path.dirname(your_file_path)}")
#>>> Dir:D:yourdirpath