I made this code snippet to loop through the contents of the list files.
lista_nome_base_docs = ['a.txt', 'b.txt', 'c.txt']
tamanho = len(lista_nome_base_docs)
print (tamanho)
lista_geral_arquivos = []
for i in range(tamanho):
with open(lista_nome_base_docs[i],"r") as arquivo:
conteudo = [line.strip() for line in arquivo if line.strip() != "" and line.strip() != "." and line.strip() != "\n" and line.strip() != "!" and line.strip() != "?" and line.strip() != ":" and line.strip() != "," and line.strip() != ""]
lista_geral_arquivos.append(conteudo)
print (lista_geral_arquivos)
but my list list gets this content:
[['€\x03]q\x00]q\x01a.'], ['€\x03]q\x00]q\x01a.'], ['€\x03]q\x00]q\x01a.']]
Does anyone know how words appear instead of these strange characters? I already tried .read()
and .readlines()
and they are not putting every word in a list position but rather this lot of messy characters ...