Tutorials Point


  Python Basics
  Python Advanced
  Python Useful References
  Python Useful Resources
  Selected Reading

© 2011 TutorialsPoint.COM


  Home     References     Discussion Forums     About TP  

Python os.mkdir() Method


previous next AddThis Social Bookmark Button


Description:

This method 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:

os.mkdir(path[, mode])

Parameters:

Here is the detail of parameters:

  • path: This is the path which needs to be created.

  • mode: Mode of the directories to be given.

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"

This would produce following result:

Path is created


previous next Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names