Python os.minor() Method
os.minor() Overview
The os.minor() method is used to extract the device minor number from the original device number (using the st_dev or st_rdev field in stat ).
os.minor() Syntax
The minor() method syntax format is as follows.
os.minor(device)
os.minor() Parameters
- device – the original device (use the st_dev or st_rdev field in stat )
os.minor() Return Value
Returns the device minor number.
os.minor() Demo#1
The following example demonstrates the use of the minor() method.
#!/usr/bin/python3
import os, sys
path = "/root/apidemos.com.txt"
# Get tuple
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 by os.major:", major_dnum)
print ("Minor device number by os.minor:", minor_dnum)
Output: