python 系统设置

1. 设置python运行环境为utf-8

import sys  #引用sys模块
reload(sys)  #重新加载sys
sys.setdefaultencoding("utf-8")  #调用setdefaultencoding函数

 2.指定py文件保存与读取的编码

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
原文地址:https://www.cnblogs.com/harry-xiaojun/p/6739842.html