You can create new directories in python using the OS module. First you have to specify the path under which the folder should be created. If there is no folder with the given name, it will be created with the mkdir() function. If the folder already exists under the given path, an error message is displayed.
import os
dir = "/path/directory-name"
try:
os.mkdir(dir)
print("Directory created successfully")
except FileExistsError:
print("Directory creation failed")
Directory created successfully