28.10.2021 Views

Python Tutorial ( PDFDrive )

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

Let us compile and run the above program, this will produce the following result:

Major Device Number : 0

Minor Device Number : 103

os.mkdir(path[, mode])

Description

The method mkdir() create a directory named path with numeric mode mode. The default mode is 0777 (octal).

On some systems, mode is ignored. Where it is used, the current umask value is first masked out.

Syntax

Following is the syntax for mkdir() method:

os.mkdir(path[, mode])

Parameters

• path -- This is the path, which needs to be created.

• mode -- This is the mode of the directories to be given.

TUTORIALS POINT

Simply Easy Learning

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!