python语言,如何在已有的文件夹下创建新的文件夹

如题所述

第1个回答  2018-05-29
year = "时间"

month = "月份"

day = "天数"

path = "D:\\Env\\bair\\"

title_year = str(year)

title_month = str(month)

title_day = str(day)

new_path_year = os.path.join(path,title_year)

if not os.path.isdir(new_path_year):

os.makedirs(new_path_year)

new_path_month = os.path.join(new_path_year,title_month)

if not os.path.isdir(new_path_month):

os.makedirs(new_path_month)

new_path_day = os.path.join(new_path_month,title_day)

if not os.path.isdir(new_path_day)
根据具体问题类型,进行步骤拆解/原因原理分析/内容拓展等。
具体步骤如下:/导致这种情况的原因主要是……
相似回答