python读txt
data = []
for line in open("data.txt","r"): #设置文件对象并读取每一行文件
data.append(line) #将每一行文件加入到list中
currentTime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
self.teLog.append(currentTime + "******************查看日志******************")
try:
for line in open("./log.txt", "r"): # 设置文件对象并读取每一行文件
# data.append(line) # 将每一行文件加入到list中
self.teLog.append(line)
except:
QMessageBox.warning(self,
"消息框标题",
"未找到日志信息",
QMessageBox.Yes)
with open(dir+file, "r") as f: data = f.read()