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檔目錄的方法