Apr-27-2018, 11:49 PM
Good night, guys! I really need your help.
This is the code:
Please help me to fix it using the following in a txt file as nome:
This is the code:
def abreArquivo(): while True: try: nome = raw_input('Entre com o nome do arquivo: ') arqIn = open(nome) return arqIn except IOError: print 'O arquivo informado não existe.' arqIn = abreArquivo() listaOrigem = [] while True: lista = [] i = 0 linha = arqIn.readline() if linha == '': break for i in range(len(linha)): if linha[i] == "-": lista.pop() lista = ''.join(lista) listaOrigem.append(lista) break else: lista.append(linha[i]) listaDestino = [] while True: lista = [] j = 0 linha = arqIn.readline() print len(linha) if linha == '': break if len(linha) > 5: while linha[j] != ">": j += 1 for i in range(j+2,len(linha)): if linha[i] != "\n": lista.append(linha[i]) lista = ''.join(lista) listaDestino.append(lista) for i in range(len(listaOrigem)): print listaOrigem[i] for i in range(len(listaDestino)): print listaDestino[i]I don't know what is going on with the listaDestino, once the listaOrigem is working pretty well.
Please help me to fix it using the following in a txt file as nome:
A -> X
B -> Y
B -> Y