【日常笔记】20230113——获取python工程根目录路径

import os
project_name = 'potato-kg-service'
cur_path = os.path.abspath(os.path.dirname(__file__))
project_dir = cur_path[:cur_path.find(project_name)]+project_name

你可能感兴趣的:(日常随记,python)