Answers for "allows python code to create folders"

13

create folder python

import os

# define the name of the directory to be created
path = "/tmp/year"

try:
    os.mkdir(path)
except OSError:
    print ("Creation of the directory %s failed" % path)
else:
    print ("Successfully created the directory %s " % path)
Posted by: Guest on April-19-2020
0

create folder python

from pathlib import Path
Path("/my/directory").mkdir(parents=True, exist_ok=True)
Posted by: Guest on November-15-2021

Code answers related to "allows python code to create folders"

Python Answers by Framework

Browse Popular Code Answers by Language