=?GB2312?B?d3JpdGUg5Lit5paHIGludG8gYzpcdDE=?=

contro opinion contropinion at gmail.com
Thu Jan 26 21:46:52 EST 2012


>>> s='\xd6\xd0\xce\xc4'
>>> print s
>>> ÖÐÎÄ
>>> s1=s.decode('gbk').encode('utf-8')
>>> print s1
>>> 中文
>>> file=open('c:\\t1','w')
>>> file.write(s1)
>>> file.close()

when i open c:\t1,i get ÖÐÎÄ in it,
how can i write  中文 into  c:\t1??
>>> file.write(print s1)
  File "<stdin>", line 1
    file.write(print s1)
                   ^
SyntaxError: invalid syntax
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120127/74825d21/attachment.html>


More information about the Python-list mailing list