以当前日期和时间格式保存文件

时间:2019-08-20 10:32:52

标签: python timestamp android-sensors

我正在记录带有时间戳的传感器读数。

我想以当前日期和时间名称格式保存文件,例如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')

1 个答案:

答案 0 :(得分:1)

您可以执行以下操作:

[
    {
        "id": 1,
        "name": "1",
        "colors": [
            {
                "id": 1,
                "stocks_id": 1,
                "color_name": "Red",
                "icon": "111.png",
                "images": [
                    {
                        "url": "111-111.png"
                    }
                ]
            },
            {
                "id": 2,
                "stocks_id": 2,
                "color_name": "green",
                "icon": "222.png",
                "images": [
                    {
                        "url": "111-111.png"
                    }
                ]
            }
        ],
    }
]