Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to access a file from root folder in python project

from from_root import from_root, from_here

# path to config file at the root of your project
# (no matter from what file of the project the function is called!)
config_path = from_root('config.json')

# path to the data.csv file at the same directory where the callee script is located
# (has nothing to do with the current working directory)
data_path = from_here('data.csv')
Comment

PREVIOUS NEXT
Code Example
Python :: matplotlib tick label position left and right x axis 
Python :: python add hyphen to string 
Python :: tic tac toe pygame 
Python :: import excel 
Python :: python string is in list 
Python :: python string replace 
Python :: seaborn factorplot python 
Python :: conditional and in python 
Python :: cpickle python 
Python :: Python NumPy stack Function Example with 2d array 
Python :: Function in python with input method 
Python :: python format new 
Python :: get resolution of image python 
Python :: Maximize Difference 
Python :: functions in python programming 
Python :: Python Join Lists 
Python :: extract images from pdf 
Python :: pyspark drop 
Python :: percent sign in python 
Python :: change a decimal to time in datetime python 
Python :: insert function in list 
Python :: python equivalent of R sample function 
Python :: python how to make boxplots with jitter 
Python :: how should i learn python 
Python :: python lockfile 
Python :: keras load model with custom objects 
Python :: python class without init 
Python :: for loop only for first 10 python 
Python :: python tutorial 
Python :: how to write a function in python 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =