Python方法获取得文件创建日期不正确是为什么?,python创建日期,python 版本是 2
Python方法获取得文件创建日期不正确是为什么?,python创建日期,python 版本是 2
python 版本是 2.7
使用 os.path.getctime(file) 取得的文件创建日期和文件的真实的创建日期不一致。我的文件是18日创建的,可是取得的i日期却是26日?请问这是为什么?如何取得正确的日期?谢谢
你不是 windows 吧
os.path.getctime(path)
Return the system’s ctime which, on some systems (like Unix) is the time of the last metadata change, and, on others (like Windows), is the creation time for path. The return value is a number giving the number of seconds since the epoch (see the time module). Raise os.error if the file does not exist or is inaccessible.
在Linux中,没有文件创建时间的概念。只有文件的访问时间、修改时间、状态改变时间。也就是说不能知道文件的创建时间。
但如果文件创建后就没有修改过,修改时间=创建时间;如果文件创建后,状态就没有改变过,那么状态改变时间=创建时间;如果文件创建后,没有被读取过,那么访问时间=创建时间,这个基本不太可能。
与文件相关的几个时间:
编橙之家文章,
相关内容
- py2exe编译链接python代码报错ImportError,py2exeimporterror,使
- 请教python下载网页torrent文件的方法,pythontorrent,http:/
- Python统计网站流量及访客求交流,python访客,统计网站的
- python fabric批量管理多台server执行方法问题,pythonfabri
- 请问有Vim编辑器删除末尾空白字符操作快捷方式吗?,
- android解锁种数代码哪位python大神精通望指点,androidp
- 为什么我的for循环列表中最后一项总会被覆盖的原因是
- 我的python DHT11测温代码运行出错是如何解决,pythondht
- Python getattr报TypeError错误,getattrtypeerror,#-*-coding:u
- Python当前目录有同名模块请问如何导入内置socket模块,
评论关闭