教程集 www.jiaochengji.com
教程集 >  Python编程  >  Python入门  >  正文 Python输出不了中文怎么解决

Python输出不了中文怎么解决

发布时间:2021-05-21   编辑:jiaochengji.com
教程集为您提供Python输出不了中文怎么解决等资源,欢迎您收藏本站,我们将为您提供最新的Python输出不了中文怎么解决资源

在文件头加上#encoding:utf-8即可。

相关推荐:《Python教程》

# encoding: utf-8
print 'helloworld'
print u"学习"
print (unicode("学习", encoding="utf-8"))

shell输出: 

helloworld
学习
学习

还可以用#-*- coding: UTF-8 -*- 来指定。

您可能感兴趣的文章:
执行python脚本出现乱码怎么解决
Python输出不了中文怎么解决
电脑不能输入汉字怎么办?中文无法输入解决办法
python中换行符怎么用
Python中文乱码怎么办
在vscode中编写Python的详细步骤
Windows 8/Win 8.1卡顿怎么?win8系统慢怎么解决
powershell打不开python怎么解决
python输入错误怎么删除
Python中怎么换行输出

[关闭]
~ ~