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

热点内容
轻量应用服务器可以搭建网站吗 发布:2025-09-16 00:13:19 浏览:989
压缩机外装 发布:2025-09-15 23:59:46 浏览:447
服务器的狗是什么 发布:2025-09-15 23:20:04 浏览:688
scaletypeandroid 发布:2025-09-15 23:08:27 浏览:633
c语言指针指向数组 发布:2025-09-15 23:04:07 浏览:864
刷妖气封印脚本 发布:2025-09-15 22:59:10 浏览:598
在线抓源码 发布:2025-09-15 22:51:57 浏览:254
服务器换了ip上v2不去 发布:2025-09-15 22:50:42 浏览:854
申诉改过密码以后为什么还打不开 发布:2025-09-15 22:49:57 浏览:50
二级sql 发布:2025-09-15 22:30:38 浏览:481