Python3 os.stat_float_times()方法

stat_float_times()方法决定是否stat_result代表时间戳为浮动对象。

语法

以下是 stat_float_times()方法语法:
os.stat_float_times([newvalue])

参数

  • newvalue -- 如果 newvalue 为True,将来调用 stat() 返回值则为 float,如果是False,未来调用 stat ()函数则返回整数。如果未提及newvalue,则返回当前设置。

返回值

这个方法返回 True 或 False。

示例

下面的例子显示 stat_float_times()方法的使用。
#!/usr/bin/python3

import os, sys

# Stat information
statinfo = os.stat('a2.py')

print (statinfo)
statinfo = os.stat_float_times()
print (statinfo)
当我们运行上面的程序,它会产生以下结果:
os.stat_result(st_mode=33206, st_ino=562949953508433, st_dev=1017554828, st_nlink=1, st_uid=0, st_gid=0, st_size=27, st_atime=1455597032, st_mtime=1455597032, st_ctime=1455562995)
True

上一篇: Python3文件方法 下一篇: Python3 os文件目录的方法