I am calling os.mkdir to create a folder with a certain set of generated data. However, even though the path I specified has not been created, the os.mkdi
os.mkdir
os.mkdi
In Python 3.2 and above, you can use:
os.makedirs(path, exist_ok=True)
to avoid getting an exception if the directory already exists. This will still raise an exception if path exists and is not a directory.
path