python打印出txt中的汉字

记事本默认是ANSI的默认是GBK,需要转码,见下:

 

 

f=open("d:\python.txt","r")
content=f.read()

w= content.decode('gbk').encode('utf-8')
print w
f.close()
posted @ 2016-07-12 10:11  简单的回忆哈  阅读(367)  评论(0编辑  收藏  举报