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.makedirs() Method


previous next AddThis Social Bookmark Button


Description:

This method recursive directory creation function. Like mkdir(), but makes all intermediate-level directories needed to contain the leaf directory.

Syntax:

os.makedirs(path[, mode])

Parameters:

Here is the detail of parameters:

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

  • mode: Mode of the directories to be given.

Example:

#!/usr/bin/python

import os, sys

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

os.makedirs( 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