Os.mkdir() method is used in python to try to create a path with a numeric mode.
Note: The method gives FileExistsError if the path already exists.
Here is the syntax for the mkdir method:
os.mkdir(path[,mode])
path
is the path where you want to complete the new directory.mode
is the mode of the directory to be given. The default mode is .In some systems, the mode parameter is ignored, which sets the current umask value.
Here is the complete implementation using default mode.
# import libraryimport os# this is the directory that will be createdpath = "/home/User/Downloads/myfolder"#use os.mkdir() to create the directoryos.mkdir(path)
The official documentation can be found here.
Free Resources