“Crear carpeta python” Código de respuesta

Python Crear directorio

# 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') 
SkelliBoi

Crear carpetas en Python

newpath = 'C:\Program Files\arbitrary' 
if not os.path.exists(newpath):
    os.makedirs(newpath)
Expensive Earthworm

Crear carpeta 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)
Embarrassed Eland

Creando una nueva carpeta en Python

newpath = r'C:\Program Files\arbitrary' 
if not os.path.exists(newpath):
    os.makedirs(newpath)
Tired Tern

Crear directorio en Python

import os
directory = "Krishna"
path_dir = "C:/Users/../Desktop/current_dir/"
if not os.path.exists(directory):
	os.mkdir(os.path.join(path_dir, directory))
visualscrapper

Crear carpeta python

from pathlib import Path
Path("/my/directory").mkdir(parents=True, exist_ok=True)
Yellowed Yacare

Respuestas similares a “Crear carpeta python”

Preguntas similares a “Crear carpeta python”

Más respuestas relacionadas con “Crear carpeta python” en Python

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código