[英]saving the file in current date and time format
I'm logging sensor readings with timestamps. 我正在记录带有时间戳的传感器读数。
I want to save the file in current date and time name format, like 2019-08-20-15-20. 我想以当前日期和时间名称格式保存文件,例如2019-08-20-15-20。
Any idea how to make it?. 知道如何制作吗?
write_fmtt = " ".join("%4.8f" for _ in timestamped_camera_readings)
timestamped_camera_readings = np.append(float(timestamp),[arr1 , arr2 , arr3 , arr4])
write_fmtt += " %.0f"
with open("sensor reading.txt", "ab") as ff:
np.savetxt(ff, np.expand_dims(timestamped_camera_readings, axis=0),fmt='%f')
you can do something like this: 您可以执行以下操作:
with open("sensor reading {}.txt".format(datetime.now().strftime('%d-%m-%Y-%H-%M')), "ab") as ff:
np.savetxt(ff, np.expand_dims(timestamped_camera_readings, axis=0),fmt='%f')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.