📌  相关文章
📜  如何从 python 项目中的根文件夹访问文件 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:41.664000             🧑  作者: Mango

代码示例1
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')