当前位置:首页 » 编程语言 » symlinkpython

symlinkpython

发布时间: 2024-12-22 01:56:55

python 有哪些方法可以获取到文件的创建时间

In [3]: os.stat('./sendmail.py')
Out[3]: posix.stat_result(st_mode=33204, st_ino=313029, st_dev=64769L, st_nlink=1, st_uid=500, st_gid=500, st_size=635, st_atime=1480821883, st_mtime=1480821926, st_ctime=1480821926)
取st_ctime

import os
def get_create_time(filename):
return os.stat(filename).st_ctime
update文档

os.stat(path)
Perform the equivalent of a stat() system call on the given path. (This function follows symlinks; to stat a symlink use lstat().)

The return value is an object whose attributes correspond to the members of the stat structure, namely:

st_mode - protection bits,
st_ino - inode number,
st_dev - device,
st_nlink - number of hard links,
st_uid - user id of owner,
st_gid - group id of owner,
st_size - size of file, in bytes,
st_atime - time of most recent access,
st_mtime - time of most recent content modification,
st_ctime - platform dependent; time of most recent metadata change on Unix, or the time of creation on Windows)
可见st_ctime确实可做为created_time, 修改时间取st_mtime

热点内容
ssd英特尔快速存储技术 发布:2025-07-01 07:07:11 浏览:223
python保留小数 发布:2025-07-01 06:45:34 浏览:755
为什么服务器有多个ip地址冲突 发布:2025-07-01 06:32:09 浏览:623
java的md5算法实现 发布:2025-07-01 06:23:09 浏览:235
android默认的activity 发布:2025-07-01 06:06:12 浏览:421
青浦智能密码锁开锁多少钱 发布:2025-07-01 06:02:42 浏览:441
编译内核生成 发布:2025-07-01 05:48:23 浏览:618
咖啡压缩糖 发布:2025-07-01 05:43:58 浏览:581
云搜卡源码 发布:2025-07-01 05:32:38 浏览:543
华为服务器怎么查ip 发布:2025-07-01 05:15:18 浏览:373