1
Good guys I have the following file saved in my equipment "names.txt", this one containing 1190 lines. Follow my python2.7 code:
#/usr/bin/python env
# -*- coding: UTF-8 -*-
abrir = open("nomes.txt", "r")
for a in abrir:
print a.strip()
abrir.close()
But when it shows me the output, some names with accents it comes in the following format:
T�ri
Thais
Thauany
Thayn�
Thelma
Tiana
Ticiana
Tricia
T�nia
I have tried putting u before and continues like this, even tried using pprint in which the output was gross showing. Showing other characters in accent due to python recognizing only ASCII. Would anyone have any idea what might be going on.
I ran your code here and recognized the accents.
– gato
Strange, it could be then the output of ipython2. I will test here by the linux terminal.
– GlaucioFonseca
I circled by the terminal.
– gato
circled here now, still continues with the bad exit. Z lio Zen bio Zeus
– GlaucioFonseca
I honestly have no idea what it might be, I just opened the IDLE of python2.7 here, I wrote the code in the nail and the output still returns bad
– GlaucioFonseca
Save the file
nomes.txt
as UTF8 without GOOD and try again.– Guilherme Nascimento
@Guilhermenascimento solved that very thing
– GlaucioFonseca
I use linux I did the following I opened the names.txt with gedit gave a save as, ai in gedit itself it has the options of which formatting use ai I put utf-8 and I went the code solved
– GlaucioFonseca
@Glauciofonseca had forgotten about Gnome, I haven’t used liunx for a long time :)
– Guilherme Nascimento
@Guilhermenascimento actually don’t even use Gnome, I use Linux Arch with Xfce :)
– GlaucioFonseca
@Glauciofonseca a sim é que a maioria dos ambientes Graficos tem algumas ferramentas do Gnome hehehehe, também gosto do Xfce :)
– Guilherme Nascimento
To this and truth, some always use a gnome tools same.
– GlaucioFonseca