G
gintare
Could you please help me with special characters saving to file.
I need to write the string u'hyv\xe4' to file.
I would like to open file and to have line 'hyvä'
import codecs
word= u'hyv\xe4'
F=codecs.open(/opt/finnish.txt, 'w+','Latin-1')
F.writelines(item.encode('Latin-1'))
F.writelines(item.encode('utf8'))
F.writelines(item)
F.close()
All three writelines gives the same result in finnish.txt: hyv\xe4
i would like to find 'hyvä'.
regards,
gintare
I need to write the string u'hyv\xe4' to file.
I would like to open file and to have line 'hyvä'
import codecs
word= u'hyv\xe4'
F=codecs.open(/opt/finnish.txt, 'w+','Latin-1')
F.writelines(item.encode('Latin-1'))
F.writelines(item.encode('utf8'))
F.writelines(item)
F.close()
All three writelines gives the same result in finnish.txt: hyv\xe4
i would like to find 'hyvä'.
regards,
gintare