28.10.2021 Views

Python Tutorial ( PDFDrive )

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

# stat information

statinfo = os.stat('a2.py')

print statinfo

statinfo = os.stat_float_times()

print statinfo

Let us compile and run the above program, this will produce the following result:

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.statvfs(path)

Description

The method statvfs() performs a statvfs system call on the given path.

Syntax

Following is the syntax for statvfs() method:

os.statvfs(path)

Parameters

• path -- This is the path whose statvfs information is required.

Return Value

Here is the list of members of statvfs structure:

• f_bsize: preferred file system block size.

• f_frsize: fundamental file system block size.

• f_blocks: total number of blocks in the filesystem.

• f_bfree: total number of free blocks.

• f_bavail: free blocks available to non-super user.

• f_files: total number of file nodes.

• f_ffree: total number of free file nodes.

• f_favail: free nodes available to non-super user.

• f_flag: system dependent.

• f_namemax: maximum file name length.

Example

The following example shows the usage of statvfs() method.

# !/usr/bin/python

TUTORIALS POINT

Simply Easy Learning

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!