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.

# Now get the touple

info = os.lstat(path)

# Get major and minor device number

major_dnum = os.major(info.st_dev)

minor_dnum = os.minor(info.st_dev)

print "Major Device Number :", major_dnum

print "Minor Device Number :", minor_dnum

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

Major Device Number : 0

Minor Device Number : 103

os.makedev(major, minor)

Description

The method makedev() composes a raw device number from the major and minor device numbers.

Syntax

Following is the syntax for makedev() method:

os.makedev(major, minor)

Parameters

• major -- This is Major device number.

• minor -- This is Minor device number.

Return Value

This method returns the device number.

Example

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

#!/usr/bin/python

import os, sys

path = "/var/www/html/foo.txt"

# Now get the touple

info = os.lstat(path)

# Get major and minor device number

major_dnum = os.major(info.st_dev)

minor_dnum = os.minor(info.st_dev)

print "Major Device Number :", major_dnum

print "Minor Device Number :", minor_dnum

# Make a device number

TUTORIALS POINT

Simply Easy Learning

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

Saved successfully!

Ooh no, something went wrong!