1. # coding:utf-8

https://www.python.org/dev/peps/pep-0263/
2. sys.getdefaultencoding()
是设置默认的string的编码格式

 

#! /usr/bin/env python 
# -*- coding: utf-8 -*- 

import sys 
reload(sys) # Python2.5 初始化后会删除 sys.setdefaultencoding 这个方法,我们需要重新载入 
sys.setdefaultencoding('utf-8') 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-19
  • 2021-07-30
  • 2021-07-06
  • 2022-02-08
  • 2022-12-23
  • 2021-12-07
猜你喜欢
  • 2021-07-05
  • 2021-12-15
  • 2021-05-21
  • 2021-11-23
  • 2021-09-02
  • 2021-11-27
  • 2021-10-18
相关资源
相似解决方案