-
-
Save niceinjeolmi/d680836566cdf6a8a57f129cb8b43ab4 to your computer and use it in GitHub Desktop.
Create a folder with Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def createFolder(directory): | |
try: | |
if not os.path.exists(directory): | |
os.makedirs(directory) | |
except OSError: | |
print ('Error: Creating directory. ' + directory) | |
# Example | |
createFolder('./data/') | |
# Creates a folder in the current directory called data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment