I wanted to convert a large file containing characters like \ u30d5
, so I looked it up. If there are few characters, there is a WEB tool so there is no need to do it.
py
# coding: utf-8
import codecs
fin = codecs.open('C:/tmp/a1.txt', 'r')
fout = codecs.open('C:/tmp/a2.txt', 'w', 'sjis')
for line in fin:
s = line.decode("unicode-escape")
fout.write(s)
fin.close()
fout.close()
Recommended Posts