python处理utf8编码中文,需要在py文件的第一行加入:# -*- coding:utf-8 -*- 或者 #coding=utf-8

打印字符串时,使用print str.encode('utf8');

打印中文列表时,使用循环 for key in list:print key

打印中文字典时,可以使用循环,也可以使用json:

  import json

  print json.dumps(dict, encoding='UTF-8', ensure_ascii=False)

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-19
  • 2022-12-23
  • 2022-01-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-09
  • 2022-02-26
  • 2021-10-27
  • 2021-09-19
相关资源
相似解决方案