How to create a directory recursively using Python?

PythonServer Side ProgrammingProgramming

To create a directory recursively, provide the path you want to create to the os.makedirs(path). To create a directory recursively, you need to specify exists_ok as True to allow existing folders.

import os
os.makedirs('my_folder/another/folder', exists_ok=True)
raja
Published on 22-Dec-2017 12:53:34
Advertisements