Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Errors while using os.makedirs() method

# Python program to explain os.makedirs() method

# importing os module
import os

# os.makedirs() method will raise
# an OSError if the directory
# to be created already exists

	
# Directory
directory = "ranjeet"

# Parent Directory path
parent_dir = "/home/User/Documents/Softhunt"

# Path
path = os.path.join(parent_dir, directory)

# Create the directory
# 'ranjeet'
os.makedirs(path)
print("Directory '%s' created" %directory)
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Errors #method
ADD COMMENT
Topic
Name
9+1 =