正则表达式教程参考:
正则表达式 - 菜鸟教程
正则调试工具
正则可视化工具
# coding=utf8
import re
import matplotlib.pyplot as plt
# 文件名
filename = "E:/rb5/debug/hard_write/3840x3840-2.txt"
string = open(filename, encoding="UTF-8").read()
# a = re.findall(r"FastDetect cost: (/d+\.?\d*)", string)
# a = re.findall(r"stage3: (\d+\.?\d*)", string)
a = re.findall(r"write:(\d+\.?\d*)ms"r"", string)
b = list(map(float, a))
b = b[:]
print(b)
print("size:", len(b))
print("avg:", format(sum(b) / len(b), '.3f'), "max:", max(b), ",min:", min(b))