Answers for "can we create new folder while creating path"

3

create a directory python

#creates a directory without throwing an error
import os
def create_dir(dir):
  if not os.path.exists(dir):
    os.makedirs(dir)
    print("Created Directory : ", dir)
  else:
    print("Directory already existed : ", dir)
  return dir
Posted by: Guest on July-25-2020

Code answers related to "can we create new folder while creating path"

Python Answers by Framework

Browse Popular Code Answers by Language