Os Minor
# Python2.x Python os.minor() Method
[ Python OS File/Directory Methods](#)
* * *
### Overview
The os.minor() method is used to extract the device minor number from the raw device number (using st_dev or st_rdev field in stat).
### Syntax
The **minor()** method syntax is as follows:
os.minor(device)
### Parameters
* **device** -- The raw device (using st_dev or st_rdev field in stat)
### Return Value
Returns the device minor number.
### Example
The following example demonstrates the use of the minor() method:
#!/usr/bin/python# -*- coding: UTF-8 -*-import os, sys path = "/var/www/html/foo.txt"# Get metadata info = os.lstat(path)# Get major and minor device numbers 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
The output of the above program is:
Major device number : 0Minor device number : 103
[ Python OS File/Directory Methods](#)
YouTip