import sys
print(sys.getdefaultencoding()) # utf-8
with open('bm.txt','r') as myfile: # 默认编码格式是utf-8,记事本编码格式也是utf-8,为啥不加'encoding=utf-8'会报错呢?
print(myfile.read()) # 输出结果:123456鍝堝搱
with open('bm.txt','r',encoding='utf-8') as myfile:
print(myfile.read()) # 输出结果:123456哈哈
文本内容