python3如何输出中文


当前第2页 返回上一页

1

2

3

import io , sys

sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding='utf-8')

sys.stderr = io.TextIOWrapper(sys.stderr.detach(), encoding='utf-8')

注:python2版本的解决方法如下:

1

2

3

import sys

reload(sys)

sys.setdefaultencoding('utf8')

更多Python相关技术文章,请访问Python教程栏目进行学习!

以上就是python3如何输出中文的详细内容,更多文章请关注木庄网络博客!!

返回前面的内容

相关阅读 >>

Python中set不常用吗

Python中gensim库word2vec的使用

Python快速排序,插入排序算法,自定义排序实例详解

Python中关于string相关操作的实例分析

Python实现ping指定ip的示例

Python编译正则表达式提高效率方法详解

Python + selenium自动化环境搭建的完整步骤

ipad怎么写Python

怎样用numpy找出数组里最大与最小值

Python中的split是什么

更多相关阅读请进入《Python》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...