0
Good night! I’m having trouble recovering files. txt with python for popular lists or dictionaries, the problem is that these files do not come with uft-8 formatting. example of txt content: what is today’s date? (here comes a tab separating) askdate
python code that reads the file:
lines = open("cmds.txt", "r").readlines()
#adicionando os comandos no dicionário
for line in lines:
line = line.replace('\n', '')#removendo os espaços
parts = line.split("\t") #separação por tab
dict_cmds.update({parts[0] : parts[1]})
this is populated a dictionary and if I print the dictionary then it will not recognize the "is".
In the
open()
you can already define the type of encoding, in the doc explains it better.– Tuxpilgrim