python获取当前目录,目录拼接,打开指定文件夹的方法

    def path(self):
        # 获取当前目录
        path = os.getcwd()
        # 目录拼接
        filepath = os.path.join(path, "test_report")
        # 打开目录
        os.startfile(filepath)

通过 按钮绑定实现点击按钮打开目录

# 按钮绑定-打开报告
self.pushButton_2.clicked.connect(self.path)

猜你喜欢

转载自blog.csdn.net/djkk1230/article/details/123640061
今日推荐