返回顶部

收藏

Built-in function unicode() provides access to all registered Unicode codecs

更多
#Built-in function unicode() provides access to all registered Unicode codecs 
#(COders and DECoders). 

#Some of the more well known encodings which these codecs can convert are Latin-1, 
#ASCII, UTF-8, and UTF-16. 

 #The latter two are variable-length encodings that store each Unicode character in 
#one or more bytes. The default encoding is normally set to ASCII, which passes 
#through characters in the range 0 to 127 and rejects any other characters with an 
#error. When a Unicode string is printed, written to a file, or converted with 
#str(), conversion takes place using this default encoding.

print u'abc'

print str(u'abc')

print u'\0102'

print str(u'\0104')

标签:Python,基础

收藏

0人收藏

支持

0

反对

0

发表评论