笔记
'''
批量创建文件夹
在指定路径newdir下批量创建指定个数的目录(文件夹),如果newdir目录不存在,则创建
'''
import os
import os.path
def mkdirs(path, num):
for item in range(1, num + 1):
os.mkdir(path + '/' + str(item))
if __name__ == '__main__':
path = './newdir'
if not os.path.exists(path):
os.mkdir(path)
num = eval(input('请输入要创建的目录个数:'))
mkdirs(path, num)
521

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



