python在当前路径下创建以时间为命名的指定文件夹
作者:互联网
import datetime
from pandas.tseries.offsets import Day
now_time =datetime.datetime.now().strftime("%Y%m%d")#获取当前时间
#now_time
import os
path = os.getcwd()
if not os.path.exists(path + '\\'+ 'result'+now_time):
os.mkdir(path + '\\'+ 'result'+now_time)
dirname_list = ['全省','福州','泉州','三明',,'三明','第一产业','第二产业','第三产业']
for dirname in dirname_list:
if not os.path.exists(path + '\\'+ 'result'+now_time+'\\'+dirname):
os.mkdir(path + '\\'+ 'result'+now_time+'\\'+dirname)
标签:dirname,python,路径,文件夹,result,time,path,now,os 来源: https://blog.csdn.net/u013004700/article/details/122497072