0
点赞
收藏
分享

微信扫一扫

python获取当前项目的根目录路径

禾木瞎写 2022-12-22 阅读 151

    def __init__(self):
self.object_name = 'UIAutoProject'

def get_root_path(self):
cur_path = os.getcwd()
return cur_path[:cur_path.find(self.object_name) + len(self.object_name)] + '\\'

注:该方法是通过字符串切片去找的


举报

相关推荐

0 条评论