os.makedirs(name, mode=0o777, exist_ok=False)
The function makedirs() creates a leaf directory and its parent directories recursively in the filesystem.
While the mkdir() function of os module creates a single directory in the filesystem, the makedirs() creates a directory hierarchy including a specified leaf directory.
name - The path of the leaf directory.
mode - Optional parameter. The default value is 0o777, which means all directories created along with the leaf directory will have Read, Write and Execute permissions for User, Group and others.
exist_ok - If True, when the function finds an existing directory along the path it continues creating the remaining directories. If False, a FileExistsError is raised when an existing directory is found.
# Example Python program that creates
# Leaf directory and its path
# Create parent directories and leaf directory
# Do a walk() and descend the hierarchy
# Print the contents of each directory
('./l1', ['l2'], )