python 当前时间字符串

import time
str_time_now = time.strftime("%Y-%m-%d_%H:%M:%S", time.localtime())  ##2023-01-10_09:58:33

2023-01-10_09:58:33
用str_time_now可以很方便的嵌入到文件名中,方便保存的文件不同名字!

posted @ 2023-01-10 10:00  无左无右  阅读(104)  评论(0编辑  收藏  举报