m_time = (os.path.getmtime(filename))
t_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(m_time))
str_time = str(t_time)
python 获取文件时间
于 2022-05-30 15:32:06 首次发布
本文介绍了如何在Python中使用os和time模块获取文件mtime时间戳,并将其格式化为易读的日期格式。重点在于时间处理和字符串转换技巧。





