Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

__file__ python

A = os.path.join(os.path.dirname(__file__), '..')
# A is the parent directory of the directory where program resides.

B = os.path.dirname(os.path.realpath(__file__))
# B is the canonicalised (?) directory where the program resides.

C = os.path.abspath(os.path.dirname(__file__))
# C is the absolute path of the directory where the program resides.
Comment

PREVIOUS NEXT
Code Example
Python :: Action based permissions in Django Rest V3+ 
Python :: How to install pandas-profiling 
Python :: validate ip address python 
Python :: python plotting moving average 
Python :: python reverse 2d list 
Python :: convert a dictionary to pandas dataframe 
Python :: calculate the distance between two points 
Python :: python numpy array change axis 
Python :: django boilerplate command 
Python :: pandas take first n rows 
Python :: pandas series to tuple list 
Python :: pattern in python 
Python :: pattern program in python 
Python :: plot second y axis matplotlib 
Python :: how to change python version 
Python :: python matplt 
Python :: root mean squared error 
Python :: dataframe to dict without index 
Python :: bash python csv to json 
Python :: how to sort list of dictionaries in python 
Python :: flask migrate 
Python :: Python list of dictionaries search 
Python :: python read text file next line 
Python :: django get form data from post 
Python :: dimension of tensor 
Python :: pandas pass two columns to function 
Python :: slice dataframe pandas based on condition 
Python :: apply lambda function to multiple columns pandas 
Python :: outlier removal 
Python :: change index of dataframe with list 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =