If you want to find the current directory of the Python script file, use the getcwd() method from the os module. os.getcwd() method returns the path of current working directory in string data type. Here is an example.
import os
current_directory = os.getcwd()
print(current_directory)

More tips on files
- Checking for file exists before opening it.
- A simple Python technique to find only the files in a directory.
Reference
- More about getcwd() method and files and directories in os module at Python docs.