Answers for "create directory with no path python"

44

python create directory

# This requires Python’s OS module
import os

# 'mkdir' creates a directory in current directory.
os.mkdir('tempDir') 
# can also be used with a path, if the other folders exist.
os.mkdir('tempDir2/temp2/temp')

# 'makedirs' creates a directory with it's path, if applicable.
os.makedirs('tempDir2/temp2/temp')
Posted by: Guest on February-24-2020
0

python create new folder in path that don't exist

def newfolder(path):
    import os
    try:
        os.mkdir(path)
    except:
        newfolder(path[:path.rindex("/")])
        newfolder(path)
Posted by: Guest on January-30-2022

Code answers related to "create directory with no path python"

Python Answers by Framework

Browse Popular Code Answers by Language