I have a list of directories to be created that have this structure:
Bla / Bla / Bla1.md
Bla / Bla / Bla2.md
Blu / Blue.md
Ble.md
However, the .md
files should not be created, but the folders that contain them should, and for that I have made the following script:
# -*- coding: utf-8 -*-
import os
def build ( address ) :
address = '/home/bezerk/Imagens/' + address
if not os.path.exists ( address ) :
os.makedirs ( address )
with open ( 'Arquivo.txt', 'r' ) as file :
for line in file.readlines () :
if line.endswith ( '.md' ) :
# Tratamento aqui
build ( line [:-3] )
else :
build ( line )
But I do not know why python does not recognize this Bla / Bla / Bla1.md
but a separate item like this here Ble.md
it recognizes, if anyone can give me insights to solve I'm grateful