How to create folder

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

 

from https://gist.github.com/keithweaver/562d3caa8650eefe7f84fa074e9ca949

 

posted on 2018-01-22 15:56  cdekelon  阅读(102)  评论(0编辑  收藏  举报

导航