def get_item_path(item_name):
"""
:param item_name: 项目名称,如pythonProject
:return:项目根目录
"""
# 获取当前所在文件的路径
cur_path = os.path.abspath(os.path.dirname(__file__))
# 获取根目录
return cur_path[:cur_path.find(item_name)] + item_name
标签:name,获取,python,item,path,根目录,cur
From: https://www.cnblogs.com/longronglang/p/17574133.html