On 27/12/2010 05:56, gintare wrote:
Hello,
STILL do not work. WHAT to be done.
import codecs
item=u'hyv\xe4'
F=codecs.open('/opt/finnish.txt', 'w+', 'utf8')
F.writelines(item.encode('utf8'))
> F.close()
As I said in my previous post, you shouldn't be using .writelines, and
you shouldn't encode
On Dec 27, 6:47 am, "Mark Tolonen" wrote:
> "gintare" wrote in message
> > In file i find 'hyv\xe4' instead of hyv .
>
> When you open a file with codecs.open(), it expects Unicode strings to be
> written to the file. Don't encode them again. Also, .writelines() expects
> a list of strings. Us
"gintare" wrote in message
news:83dc3076-9ddc-42bd-8c33-6af96b263...@l32g2000yqc.googlegroups.com...
Hello,
STILL do not work. WHAT to be done.
import codecs
item=u'hyv\xe4'
F=codecs.open('/opt/finnish.txt', 'w+', 'utf8')
F.writelines(item.encode('utf8'))
F.close()
In file i find 'hyv\xe4' i
Hello,
STILL do not work. WHAT to be done.
import codecs
item=u'hyv\xe4'
F=codecs.open('/opt/finnish.txt', 'w+', 'utf8')
F.writelines(item.encode('utf8'))
F.close()
In file i find 'hyv\xe4' instead of hyvä.
(Sorry for mistyping in previous letter about 'latin-1'. I was making
all possible combin
On 26/12/2010 22:43, gintare wrote:
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')
This opens the f