标签:中文 python pycharm sublime text
在使用工具时,默认输出中文字符会有报错,可以通过调整来输出中文。
Pycharm 调整:
1、调整使用字体:
file->setting->Colors & Fonts->Font 路径下选择支持中文的字体
2、文件开头加一行代码:
# -*- coding: utf-8 -*-
3、把代码写进模版里,模板路径:
file->setting->file and code templatea ->python script
Sublime Text 调整:
Python2.* 版本定义一行代码实现:
# coding=utf-8
Python 3.* 版本在文件中定义如下内容:
import sys
from io import TextIOWrapper
sys.stdout = TextIOWrapper(sys.stdout.buffer, encoding=‘utf-8‘)
标签:中文 python pycharm sublime text
原文地址:http://garyshan.blog.51cto.com/5820885/1763193