retrieve txt file in formatted with utf-8 in python

0

Good evening!    I'm having trouble recovering .txt files with python for popular lists or dictionaries, the problem is that these files do not come with uft-8 formatting. example txt content: what is today's date? (here comes a separating tab) 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 will populate a dictionary and if I print the dictionary then it will not recognize the "is".

    
asked by anonymous 10.09.2018 / 23:52

0 answers