Python How to Safely Create a Nested Directory
import os
os.getcwd()
if not os.path.exists(dir):
os.mkdir(dir)
import os
os.makedirs(path, exist_ok=True)
creates the directory and does not raise an exception if the directory already exists.
import pathlib
pathlib.Path(dir).mkdir(parents=True, exist_ok=True)
import errno
try:
os.makedirs(path)
except OSError as exception:
if exception.errno != errno.EEXIST:
raise
Watch video Python How to Safely Create a Nested Directory online without registration, duration hours minute second in high quality. This video was added by user ATOM 29 December 2018, don't forget to share it with your friends and acquaintances, it has been viewed on our site 1,452 once and liked it 5 people.