前言
假设我每天都要用一个文件夹来记录工作日志,那么每天都要自己手动使用鼠标创建今天的文件夹,是不是很麻烦?
其他办法
代码
import os
for month in range(1, 13):
for day in range(1, 32):
path = str(month) + "." + str(day)
if not os.path.exists("./" + path):
os.mkdir(path)
说明
- 每次运行下图的 “运行我” 的Python文件即可轻松实现
- 运行之后在当前目录生成文件夹
看下效果
