Python 基礎教程
os.stat() 方法用于在給定的路徑上執(zhí)行一個系統(tǒng) stat 的調用。
stat()方法語法格式如下:
os.stat(path)
path -- 指定路徑
stat 結構:
以下實例演示了 stat() 方法的使用:
#!/usr/bin/python # -*- coding: UTF-8 -*- import os, sys # 顯示文件 "a2.py" 信息 statinfo = os.stat('a2.py') print statinfo
執(zhí)行以上程序輸出結果為:
posix.stat_result(st_mode=33188, st_ino=3940649674337682L, st_dev=277923425L, st _nlink=1, st_uid=400, st_gid=401, st_size=335L, st_atime=1330498089, st_mtime=13 30498089, st_ctime=1330498089)其他擴展