how to access a file from root folder in python project

Solutions on MaxInterview for how to access a file from root folder in python project by the best coders in the world

showing results for - "how to access a file from root folder in python project"
Violette
26 Apr 2018
1from from_root import from_root, from_here
2
3# path to config file at the root of your project
4# (no matter from what file of the project the function is called!)
5config_path = from_root('config.json')
6
7# path to the data.csv file at the same directory where the callee script is located
8# (has nothing to do with the current working directory)
9data_path = from_here('data.csv')
10