The Python os.makedev() method takes two arguments namely major number and minor number, and returns an integer that represents the raw device number.
The raw devices are commonly known as Character devices. The term Character devices refers to those devices that transmit a stream of bytes. For instance, a keyboard or a mouse.
SyntaxFollowing is the syntax for Python makedev() method −
os.makedev(major, minor)Parameters
The Python os.makedev() method accepts the following parameters −
major − This is Major device number.
minor − This is Minor device number.
The Python os.makedev() method returns the raw device number.
ExampleIn the following example, we are demonstrating the use of makedev() method. Here, we are passing the minor and major device numbers to the makedev() as a parameter value. This operation will return the raw device number after evaluating the parameters.
import os, sys path = "newFile.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 ("Raw Device Number :", dev_num)
When we run above program, it produces following result −
Major Device Number : 8 Minor Device Number : 3 Raw Device Number : 2051
python_files_io.htm
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4