摘要: Python 3 写文件 UnicodeEncodeError: 'gbk' codec can't encode character 网页代码中存在“”<meta charset="gbk">“”,如果存为 utf-8,再用浏览器打开,会出现乱码。因此,必须存为 gbk。 解决方法: 在写入 st 阅读全文
posted @ 2021-12-04 22:24 emanlee 阅读(720) 评论(0) 推荐(0)
摘要: Python 3中的默认编码 Python3中默认是UTF-8 可查看Python3的默认编码。 >>> import sys >>> >>> sys.getdefaultencoding() 'utf-8' >>> 系统默认编码 指: 在python 3编译器读取.py文件时,若没有头文件编码声明 阅读全文
posted @ 2021-12-04 10:37 emanlee 阅读(1189) 评论(0) 推荐(0)