以当前日期和时间格式保存文件
saving the file in current date and time format
我正在记录带时间戳的传感器读数。
我想以当前日期和时间名称格式保存文件,例如 2019-08-20-15-20。
知道怎么做吗?
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')
你可以这样做:
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')
我正在记录带时间戳的传感器读数。
我想以当前日期和时间名称格式保存文件,例如 2019-08-20-15-20。
知道怎么做吗?
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')
你可以这样做:
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')