用python提取log电流数据
用python提取电流数据,写入到新文件,再手动复制到Excel计算平均电流。
path = "19-12-26-22-35-05kernel.txt"
def readfile(name):
fin=open(name, 'r')
fout = open(path + ".out.txt", 'w')
for lines in fin.readlines(): #按行读取text中的内容
if 'IBAT=' in str(lines):
#print(lines)
index = lines.find('IBAT=')
index2 = lines.find(': VSYS=')
fout.write(lines[index + 7: index2] + '\n')
fout.close()
fin.close()
if __name__ == "__main__":
readfile(path)
参考
利用python对多个txt文件中的数据进行筛选_heavenmark的博客-CSDN博客
https://blog.csdn.net/heavenmark/article/details/73526921