According to a lot of men's emails, I raise the following table, but I lack some instructions, please inform us:
Here are some methods for coding conversion,
Excuse me, (3) and (5) in the following table, ie
What is the use of Str.Encode and Unicode.Decode? Can you give an example?
(1) Unicode ()
Global function, convert the Str string from other encodings (such as GB2312) to Unicode objects (2) str.Decode ()
The STR string method, converts the Str string from other codes (such as GB2312) into Unicode objects, and Unicode () very similar to Unicode (). (3) str.encode ()
String method, (4) Unicode.Encode ()
The method of the Unicode object, convert the Unicode object to other correspondingly encoded Str string objects, such as GB2312. (5) unicode.Decode ()
Unicode object method
I will give an application example of the entries (1), (2), (4) method here, please supplement (3), (5) application examples.
Example: >>> s = "Chinese" #STR object >>> SS = u "Chinese" #unicode object >>> Type (s)