Python 方法 stat_float_times() 确定 stat_result 是否将时间戳表示为 float 对象。
Python os 模块的 stat_float_times() 方法已弃用。它在 Python 的未来版本中将不可用。
语法
以下是 Python os.stat_float_times() 方法的语法 −
os.stat_float_times([newvalue])
参数
Python os.stat_float_times() 方法接受单个参数 -
- newvalue − 如果 newvalue 为 True,则未来对 stat() 的调用返回浮点数,如果为 False,则未来对 stat 的调用返回 ints。如果未提及 newvalue,则返回当前设置。
返回值
Python os.stat_float_times() 方法返回 True 或 False。
例以下示例显示了 stat_float_times() 方法的用法。
import os, sys
# Stat information
statinfo = os.stat('a2.py')
print statinfo
statinfo = os.stat_float_times()
print statinfo
当我们运行上述程序时,它会产生以下结果——
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)
True
st_nlink=1, st_uid=400, st_gid=401, st_size=335L, st_atime=1330498089, st_mtime=13
30498089, st_ctime=1330498089)
True