几行用于简繁编码转换的python代码
时间:2006-06-21 来源:recordus
刚刚在list里看到有人问limodou老大以前写的简繁转换程序,就随手写了几行,试了下可以正确进行转换,也贴进了list:
#coding=gbk
chstr = "中文"
big5file = open("big5.txt","w")
big5file.write(chstr.decode("gbk").encode("big5"))
big5file.close()
txt = open("big5.txt").read()
gbfile = open("gb.txt","w")
gbfile.write(txt.decode("big5").encode("gbk"))
gbfile.close()
#coding=gbk
chstr = "中文"
big5file = open("big5.txt","w")
big5file.write(chstr.decode("gbk").encode("big5"))
big5file.close()
txt = open("big5.txt").read()
gbfile = open("gb.txt","w")
gbfile.write(txt.decode("big5").encode("gbk"))
gbfile.close()
相关阅读 更多 +