If Dir Not Exist Mkdir Python

[Solved] If Dir Not Exist Mkdir Python | Python - Code Explorer | yomemimo.com
Question : if dir not exist mkdir python

Answered by : nice-newt-l4zhl7y4dx1g

import os
if not os.path.exists('my_folder'):
    os.makedirs('my_folder')

Source : https://www.tutorialspoint.com/How-can-I-create-a-directory-if-it-does-not-exist-using-Python | Last Update : Fri, 17 Apr 20

Question : mkdir if not exists python

Answered by : yellowed-yacare-qnc1i7of89qk

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

Source : https://stackoverflow.com/questions/273192/how-can-i-safely-create-a-nested-directory-in-python | Last Update : Mon, 22 Nov 21

Answers related to if dir not exist mkdir python

Code Explorer Popular Question For Python