Python os.stat_float_times() Method

Python File(文件) 方法Python OS File/Directory Methods


Overview

The os.stat_float_times() method is used to decide whether stat_result displays timestamps as float objects.

Syntax

stat_float_times()The method syntax is as follows:

os.stat_float_times([newvalue])

Parameters

  • newvalue-- If True, calls to stat() return floats; if False, calls to stat return ints. If this parameter is absent, returns the current setting.

Return Value

Returns True or False.

Examples

The following example demonstrates the use of the stat_float_times() method:

#!/usr/bin/python
# -*- coding: UTF-8 -*-

import os, sys

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

print statinfo
statinfo = os.stat_float_times()
print statinfo

The output of running the above program is:

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

Python File(文件) 方法Python OS File/Directory Methods

Other Extensions