Latest web development tutorials

Python os.stat_float_times () method

Python File (File) method Python OS file / directory methods


Outline

os.stat_float_times () method used to decide whether to float objects stat_result display timestamps.

grammar

stat_float_times () method syntax is as follows:

os.stat_float_times([newvalue])

parameter

  • newvalue - If True, call stat () return floats, if False, call stat return ints.Without this parameter returns the current setting.

return value

Returns True or False.

Examples

The following example demonstrates stat_float_times () method of use:

#!/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 above program output 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 (File) method Python OS file / directory methods