The website of Lei Chen

Sunshine and rain of a developer

Use Python To Convert ASCII to UTF-16

Posted by hide1713 on June 17, 2009

Such an easy thing. But I took 1 hours to figure out.

import codecs
f=open(“wall.obj”,’r')
txt = f.read()
print txt
f.close()

of = codecs.open(“uwall.obj”,’w',’utf-16′)
of.write(txt)
of.close()

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>