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!'
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脚本,用于在指定路径下创建文件夹。如果目标路径不存在,脚本会尝试递归创建所有必要的目录。该脚本适用于自动化文件管理和部署流程。
4016

被折叠的 条评论
为什么被折叠?



