从报告里抠数
真机上 报告.txt 是四行「项目 空格 值」。要在脚本里取某一项,先在这里练:
text = "任务数 8\n总字节 36300\n用时 4.1\n方式 线程\n"
info = {}
for line in text.strip().split("\n"):
key, val = line.split(" ", 1)
info[key] = val
print(info["总字节"] + "/" + str(round(float(info["用时"]))) + "/" + info["方式"])
全部评论