python打印出txt中的汉字

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

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

w= content.decode('gbk').encode('utf-8')
print w
f.close()
原文地址:https://www.cnblogs.com/wlyd/p/5662564.html