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.

dev_num = os.makedev(major_dnum, minor_dnum)

print "Device Number :", dev_num

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

Major Device Number : 0

Minor Device Number : 103

Device Number : 103

os.makedirs(path[, mode])

Description

The method makedirs() is recursive directory creation function. Like mkdir(), but makes all intermediate-level

directories needed to contain the leaf directory.

Syntax

Following is the syntax for makedirs() method:

os.makedirs(path[, mode])

Parameters

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

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

Return Value

This method does not return any value.

Example

The following example shows the usage of makedirs() method.

#!/usr/bin/python

import os, sys

# Path to be created

path = "/tmp/home/monthly/daily"

os.makedirs( path, 0755 );

print "Path is created"

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

Path is created

os.minor(device)

Description

The method minor() extracts the device minor number from a raw device number (usually the st_dev or st_rdev

field from stat).

TUTORIALS POINT

Simply Easy Learning

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

Saved successfully!

Ooh no, something went wrong!