Tutorials Point


  Python Basics
  Python Advanced
  Python Useful References
  Python Useful Resources
  Selected Reading

© 2011 TutorialsPoint.COM


  Home     References     Discussion Forums     About TP  

Python os.makedev() Method


previous next AddThis Social Bookmark Button


Description:

This method composes a raw device number from the major and minor device numbers.

Syntax:

os.makedev(major, minor)

Parameters:

Here is the detail of parameters:

  • major: Major device number

  • major: Minor device number

Example:

#!/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
dev_num = os.makedev(major_dnum, minor_dnum)
print "Device Number :", dev_num

This would produce following result:

Major Device Number : 0
Minor Device Number : 103
Device Number : 103


previous next Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names