python 3 try except (try catch)

try:
    for line in open("./log.txt", "r"):  # 设置文件对象并读取每一行文件
        # data.append(line)  # 将每一行文件加入到list中
        self.teLog.append(line)
except Exception as e:
    print(e)
    QMessageBox.warning(self,
                        "消息框标题",
                        "未找到日志信息",
                        QMessageBox.Yes)
posted @ 2020-12-16 12:10  bH1pJ  阅读(393)  评论(0编辑  收藏  举报