Python os.stat_float_times() 方法



Python 方法stat_float_times() 用於確定 stat_result 是否將時間戳表示為浮點數物件。

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 的呼叫將返回整數。如果未指定 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
os_file_methods.htm
廣告

© . All rights reserved.