Easy Tutorial
❮ Ref Math Pow Ref Math Log1P ❯

Python3 os.stat() Method

Python3 OS File/Directory Methods


Overview

The os.stat() method is used to perform a system stat call on the given path.

Syntax

The syntax for the stat() method is as follows:

os.stat(path)

Parameters

Return Value

Stat structure:

Example

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

#!/usr/bin/python3

import os, sys

# Display file information for "a2.py"
statinfo = os.stat('a2.py')

print(statinfo)

Executing the above program outputs:

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=1330498089, st_ctime=1330498089)

Python3 OS File/Directory Methods

❮ Ref Math Pow Ref Math Log1P ❯