Coding problem has always been a headache problem:
when the string is: ' \u4e2d\u56fd '
>>>s=[' \u4e2d\u56fd ', ' \u6e05\u534e\u5927\u5b66 ']
>>>str=s[0].decode (' Unicode_escape ') #.encode ("Euc_kr")
>>>print Str
China
When the string is: ' & #19996;& #20122;& #23398;& #22242;& #19968;& #20013; '
>>>print UNICHR (19996)
East
Ord () supports Unicode, which can display Unicode numbers for specific characters, such as:
>>>print Ord (' A ') 65
Unicode strings are generated as long as they are connected to Unicode. Such as:
>>> ' Help ' "Help" >>> ' help, ' + u ' python ' u ' help,python '
for ASCII (7-bit)-compatible strings, the Unicode string can be converted to an ASCII string with the built-in STR () function. such as:
>>> str (U ' Hello World ') ' Hello World '
An understanding of several concepts:
ASCII: corresponds to the corresponding character with the data word
And the Chinese is the location code corresponding to Chinese characters such as: "Good" ASCII code is: 22909
Unicode encoding is a piece of each country. It has UTF-8, UTF-16, UTF-32 and other forms
Chinese range 4E00-9FBF: There are gbk,gb2312 in this range,
Utf-8 is a Unicode-based international occasion for use
GB2312 and gb2312 are both of them. Earlier mainly used to encode and decode commonly used Chinese characters
Python encoding Processing: Unicode byte string translated into Chinese various strings example description