Multiple directories could be created using mkdir( ) method from pathlib.Path object.

 

import pathlib

p = pathlib.Path('2022/10/05')
p.mkdir(parents=True)

 

By default, Path.mkdir() raise an OSError if the target directory already exists. This behavior can be overridden (as of Python 3.2) by passing exist_ok=True as a keyword argument when calling each function.

 

import pathlib

p = pathlib.Path('2022/10/05')
p.mkdir(parents=True,exist_ok=True)