28.10.2021 Views

Python Tutorial ( PDFDrive )

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

import os, sys

# showing statvfs information of file "a1.py"

stinfo = os.statvfs('a1.py')

print stinfo

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

posix.statvfs_result(f_bsize=4096, f_frsize=4096, f_blocks=1909350L,

f_bfree=1491513L,

f_bavail=1394521L, f_files=971520L, f_ffree=883302L, f_fvail=883302L, f_flag=0,

f_namemax=255)

os.symlink(src, dst)

Description

The method symlink() creates a symbolic link dst pointing to src.

Syntax

Following is the syntax for symlink() method:

os.symlink(src, dst)

Parameters

• src -- This is the source.

• dest -- This is the destination, which didn't exist previously.

Return Value

This method does not return any value.

Example

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

#!/usr/bin/python

import os

src = '/usr/bin/python'

dst = '/tmp/python'

# This creates a symbolic link on python in tmp directory

os.symlink(src, dst)

print "symlink created"

Let us compile and run the above program, this will create s symbolic link in /tmp directory which will be as

follows:

lrwxrwxrwx. 1 root root 15 Apr 30 03:00 python -> /usr/bin/python

os.tcgetpgrp(fd)

TUTORIALS POINT

Simply Easy Learning

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

Saved successfully!

Ooh no, something went wrong!