directory of python script in folder code example
Example 1: python how to get directory of script
import os
print(os.path.abspath(''))
Example 2: python file directory
from os import path
dir_path = path.dirname(__file__)
import os
print(os.path.abspath(''))
from os import path
dir_path = path.dirname(__file__)