quarta-feira, 27 de janeiro de 2021

IndentationError: unindent does not match any outer indentation level

# transforma todos os 4 espaços em tab

#Colocar na mesma pasta


def tabTxt():
    file = input("Nome do arquivo de entrada: ")
    with open(file,"r") as txtr:
        txt = txtr.read()
    i, out = 0, ""
    while i < len(txt)-1:
        if txt[i] == " " and txt[i+1] == " " and txt[i+2] == " " and txt[i+3] == " ":
            print('!')
            out += ("\t")#"    "
            i+=4
        else:
            out += txt[i]
            i+=1
    file = input("Nome do arquivo de saida: ")
    with open(file,"w") as txtw:
        txtw.write(out)
tabTxt()

Nenhum comentário:

Postar um comentário