python 创建新文件夹

import os
def create_foleder(foldernames):
    current_position="E:/"
    foldername=str(current_position)+str(foldernames)+"/"
    isCreated=os.path.exists(foldernames)
    if not isCreated:
        os.makedirs(foldernames)
        print(str(foldernames)+'is created')
        return True
    else:
        print("the folder has been created before")
        return False
#在e盘创建文件夹,输入文件夹名字,在e盘创建,如果已经存在就输出已存在

你可能感兴趣的:(python)