Python coding knowledge learning notes, python learning notes
Python coding knowledge learning notes
>>> A = 'medium' ===> a is an encoded binary. It adopts the default encoding method of the operating system, similar to byte.
>>> S = U' '===> s is a unicode type, 32-bit integer, and the variable content is a unicode code word (codepoint)
>>>
'\ Xd6 \ xd0' ==> as described above, the current system is GBK encoding, And the binary value of GBK Encoding
>>> S
U' \ u4e2d '==> as mentioned above, the 4e2d code is stored, consistent with the unicode definition.
>>> Print
Medium
>>> Print s
Medium
>>> A. decode ('gbk'). encode ('utf-8') ==> After decoding a string, encode it using utf8.
'\ Xe4 \ xb8 \ xad'
>>> S. encode ('utf-8') ==> encode the code 4e2d using the utf8 encoding scheme, and output the encoded binary value and
'\ Xe4 \ xb8 \ xad' ==> the content in step 1 is consistent.