Python os.makedirs() Function Syntax
Syntax: os.makedirs(path, mode = 0o777, exist_ok = False)
Parameter:
- path: A path-like object representing a file system path. A path-like object is either a string or bytes object representing a path.
- mode (optional) : A Integer value representing mode of the newly created directory..If this parameter is omitted then the default value Oo777 is used.
- exist_ok (optional) : A default value False is used for this parameter. If the target directory already exists an OSError is raised if its value is False otherwise not. For value True leaves directory unaltered.
Return Type: This method does not return any value.
Python | os.makedirs() method
All functions in the os module raise OSError in the case of invalid or inaccessible file names and paths, or other arguments that have the correct type but are not accepted by the operating system. In this article, we will see how to create directories recursively using the os module and also about os.makedirs() method.
Contact Us