从源到simi编辑时间格式

2024-04-26 20:45:38 发布

您现在位置:Python中文网/ 问答频道 /正文

正在尝试编辑“文件时间”中的时间格式,如“现在”中的时间格式。我尝试的每件事都会出错。如何将“filetime”的格式设置为“now”

from time import gmtime, strftime, localtime
import time
import os

now = strftime ("%d %b %Y %H:%M:%S", localtime())
print (now)

filetime = time.ctime(os.path.getctime (r"C:\Users\harila\file.txt"))
print (filetime)

Tags: 文件fromimport编辑timeos格式时间