Python method makedirs() is a recursive directory creation function. Like mkdir(), but makes all intermediate-level directories needed to contain the leaf directory.
Following is the syntax for makedirs() method:
os.makedirs(path[, mode])
This method does not return any value.
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"
When we run above program, it produces following result:
Path is created
Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.