■ 参考 : Pythonで深い階層のディレクトリを再帰的に作成するmakedirs
# 出力するフォルダを作成
if not os.path.exists(outdirname):
os.makedirs(outdirname)
os.mkdir()だと、同じ階層にしかディレクトリが作れないが、os.makedirs()だと再帰的に作ってくれるif not os.path.exists(outdirname):
os.makedirs(outdirname)
コマンドラインのmkdir -p みたいなもん
ランキング参加中です
↓クリックしていただけると嬉しいです〜