7
Python 新手问题 - V2EX
source link: https://www.v2ex.com/t/845249
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
windows 下 python 加了
-- coding: utf-8 --
还是报乱码,怎么解决,网上都是说加这个,但是没有效果呀!!
9 条回复 • 2022-04-06 21:10:37 +08:00
ALLROBOT 11 小时 52 分钟前
zictos 11 小时 50 分钟前
读文件的话在 windows 上要加 encoding=utf-8
raycool 11 小时 49 分钟前
问题太笼统,python2 还是 3 ?
乱码具体指哪部分。
乱码具体指哪部分。
huyan3280 11 小时 45 分钟前
class Base(object):
def __init__(self):
self._age = 10
def printInfo(self):
print("age=%d,name = %s" % (self._age,self._name))
class Child(Base):
def __init__(self):
super(Child,self).__init__()
self._name = "这里是乱码"
if __name__ == "__main__":
child = Child()
child.printInfo()
def __init__(self):
self._age = 10
def printInfo(self):
print("age=%d,name = %s" % (self._age,self._name))
class Child(Base):
def __init__(self):
super(Child,self).__init__()
self._name = "这里是乱码"
if __name__ == "__main__":
child = Child()
child.printInfo()
fgwmlhdkkkw 11 小时 44 分钟前
也有可能你把文件保存为 gbk 编码了
v2exe2v 11 小时 4 分钟前
-- coding: gb-2312 --
cmdOptionKana 10 小时 58 分钟前
1. 你的文件是自己新建的,还是网上下载的?
2. 你使用什么编辑器?
3. 你会查看文本文件的编码吗,你的这个文件是什么编码?
2. 你使用什么编辑器?
3. 你会查看文本文件的编码吗,你的这个文件是什么编码?
deplivesb 9 小时 54 分钟前
你这个不是 Python 新手,你是计算机新手
imn1 6 小时 10 分钟前
windows dos prompt 使用不是 utf 编码,它使用的字体也不支持跨字符集
使用"chcp 65001"命令(不带引号),兼容 utf-8 输出,且更改字体为支持跨字符集的字体
改字体这个需要一定的黑科技,请搜索相关文章(这个需要中文搜 google ,纯英文搜索没什么用)
使用"chcp 65001"命令(不带引号),兼容 utf-8 输出,且更改字体为支持跨字符集的字体
改字体这个需要一定的黑科技,请搜索相关文章(这个需要中文搜 google ,纯英文搜索没什么用)
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK