You are here : python_2ososmkdir

os.mkdir() - os

             

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.


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

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


Syntax


os.mkdir(path[, mode])


Example


#!/usr/bin/python

import os, sys

# Path to be created
path = "/tmp/home/monthly/daily/hourly"

os.mkdir( path, 0755 );

print "Path is created"


Output / Return Value

When we run above program, it produces following result:


Path is created


Limitations


Alternatives / See Also


Reference