当前第2页 返回上一页
案例实践:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #endcoding: utf-8
# 获取文件的时间属性
# 用到的知识
# os. getcwd () 方法用于返回当前工作目录
# os.path.getatime(file) 输出文件访问时间
# os.path.getctime(file) 输出文件的创建时间
# os.path.getmtime(file) 输出文件最近修改时间
import time
import os
def fileTime(file):
return [
time.ctime(os.path.getatime(file)),
time.ctime(os.path.getmtime(file)),
time.ctime(os.path.getctime(file))
]
times = fileTime(os. getcwd ())
print (times)
print (type(times))
|
以上就是如何获取一个文件的创建和修改时间的详细内容,更多文章请关注木庄网络博客!!
返回前面的内容
相关阅读 >>
redis缓存系统的介绍
Python是爬虫吗
Python如何调用dll库
Python标准库是什么
Python两列字符串如何合并?
Python控件怎么用
Python能画3d图吗
Python中pack和unpack用法介绍
Python3下载哪个版本
Python在哪里下载
更多相关阅读请进入《Python》频道 >>
人民邮电出版社
python入门书籍,非常畅销,超高好评,python官方公认好书。
转载请注明出处:木庄网络博客 » 如何获取一个文件的创建和修改时间