当前位置:首页 » 编程语言 » 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

热点内容
pc微信聊天记录在哪个文件夹 发布:2025-08-16 11:12:56 浏览:687
安卓车机装什么应用可以匹配原车摄像头 发布:2025-08-16 10:56:07 浏览:1000
用户环境参数配置文件怎么恢复 发布:2025-08-16 10:51:14 浏览:19
小说S加密 发布:2025-08-16 10:41:34 浏览:316
如何用命令提示符改密码无需密码 发布:2025-08-16 10:23:46 浏览:955
aov国际版是什么服务器 发布:2025-08-16 10:14:38 浏览:400
攀升编程 发布:2025-08-16 10:13:14 浏览:485
加工中心刻字编程 发布:2025-08-16 09:59:43 浏览:101
安卓手机屏幕最好的是什么手机 发布:2025-08-16 09:40:10 浏览:396
python基础pdf下载 发布:2025-08-16 09:38:25 浏览:593