Python创建目录

import os


def createFolder(folderPath):
    if not os.path.exists(folderPath):
        try:
            os.makedirs(folderPath)
        except Exception, e:
            print e


            
if __name__ == '__main__':
    sharingPath = r'C:\System_Test_Sharing'
    createFolder(sharingPath);
    print 'Finish!'

你可能感兴趣的:(Python创建目录)