logo

Python Os.minor() Method


Show

Description

Python method makedirs() is a recursive directory creation function. Like mkdir(), but makes all intermediate-level directories needed to contain the leaf directory.

syntax

Following is the syntax for minor() method:

os.minor(device)

Parameters

  • device − This is a raw device number (usually the st_dev or st_rdev field from stat).

Return Value

This method returns the device minor number.

Example

The following example shows the usage of minor() 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

When we run the above program, it produces the following result:

Major Device Number : 0
Minor Device Number : 103

Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.