Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7195553
  • 博文数量: 510
  • 博客积分: 12019
  • 博客等级: 上将
  • 技术积分: 6836
  • 用 户 组: 普通用户
  • 注册时间: 2005-08-01 16:46
文章分类

全部博文(510)

文章存档

2022年(2)

2021年(6)

2020年(59)

2019年(4)

2018年(10)

2017年(5)

2016年(2)

2015年(4)

2014年(4)

2013年(16)

2012年(47)

2011年(65)

2010年(46)

2009年(34)

2008年(52)

2007年(52)

2006年(80)

2005年(22)

分类: Python/Ruby

2020-04-04 09:16:04

#coding:utf-8
import sys
import locale

'''
系统的缺省编码(一般就是ascii):sys.getdefaultencoding()  。用于系统一些函数在处理字符串等数据时候,要先知道编码,然后用该编码处理数据

系统当前的编码:locale.getdefaultlocale()
系统代码中临时被更改的编码(通过locale.setlocale(locale.LC_ALL,“zh_CN.UTF-8″)):locale.getlocale()
文件系统的编码:sys.getfilesystemencoding()
终端的输入编码:sys.stdin.encoding
终端的输出编码:sys.stdout.encoding
代码的缺省编码:文件头上# -*- coding: utf-8 –*-
'''
print sys.getdefaultencoding()
print locale.getdefaultlocale()
print  locale.getlocale()
print sys.getfilesystemencoding()
print  sys.stdin.encoding
print  sys.stdout.encoding

阅读(586) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~