我是 python 新手。
def maintain_delta(new_vals, host, action):
file_name = build_file_name(host, action)
err, data = read_values(file_name)
old_vals = data.split(';')
new_vals = [str(int(time.time()))] + new_vals
delta = None
try:
err, delta= calc_delta(old_vals, new_vals)
except:
err = 2
write_res = write_values(file_name, ";".join(str(x) for x in new_vals))
return err + write_res, delta
源github链接:
据我了解,它从文件中读取数据并添加time.time()
函数以获取新的 val。做什么time.time()
?此函数是否生成文件名?