尝试在" filetime"中编辑时间格式就像在"现在"。我尝试的一切都获取错误。我怎样才能获得" filetime"格式化为"现在"?
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)
答案 0 :(得分:-1)
ctime = os.path.getctime(r"C:\Users\harila\file.txt")
filetime = strftime("%d %b %Y %H:%M:%S", localtime(ctime))