版权声明:转自可爱的安安的博客!qq:1085589289 https://blog.csdn.net/ac1085589289/article/details/85306457
with open('b1.s') as file_object: contents=file_object.read() print(contents)
报错:
原因:
读取文件中有中文
解决办法:
打开文件时以utf-8格式打开。
with open('b1.s',encoding='utf-8') as file_object: contents=file_object.read() print(contents)
总结:我是天才