Get the script path in Python

less than 1 minute read

How to get the script path in Python.

get-script-path.py


import os, json, datetime

#Script path
BASE_DIR = os.path.dirname(__file__)

#Specifying the data file
DATA_FILE = BASE_DIR + '/data.txt'

Tags:

Updated: