品易云推流 关闭
文章详情页
文章 > Python基础教程 > Python输出不了中文怎么解决

Python输出不了中文怎么解决

Python 输出 中文

头像

爱喝马黛茶的安东尼

2019-09-17 17:25:474998浏览 · 0收藏 · 0评论

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

相关推荐:《Python教程

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

shell输出: 

helloworld
学习
学习

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

关注

关注公众号,随时随地在线学习

本教程部分素材来源于网络,版权问题联系站长!

底部广告图