The source code of the web page captured by python is similar to u51a0u7434. How can I convert it to Chinese? The source code of the webpage captured by python is similar to \ u51a0 \ u7434. How can I convert it to Chinese?
Reply content: Find a library named ast, which contains a function called literal_eval.
Thank you for choosing to familiarize yourself with the standard library (7.8. codecs
:
>>> S = R' \ u51a0 \ u7434 '>>> print s \ u51a0 \ u7434 >>> s. decode ('unicode _ escape ') U' \ u51a0 \ u7434' >>> print s. decode ('unicode _ escape ') Guan Qin
After reading the answer from wheel brother, I thought that Python 3. x provides two built-in functions: ord and chr. Unicode code point and character conversion.
Ongoing-Study/ucps. py at master · myd7349/Ongoing-Study · GitHub
Python 2 is unavailable at hand. Orz.
2015-06-03
The previous answers are misleading! Sorry.
In Python3, how do I obtain the Chinese corresponding to the Unicode code? -Myd7349
----
'U \ u51a0 \ u7434 'is not U' \ u51a0 \ u7434'. The subject does not understand what it means, @ Liu Xiang: he does not know what the subject is asking (he knows what the subject is asking after receiving the prompt ). This 51a0 and 7434 represent the 4 bytes in hexadecimal format. This is unicode encoding. python must provide a function to convert numbers to character or byte arrays to strings. You must first process them into numbers, and then turn.
Javascript:
This is actually This is actually
Unicode. Unicode uses a 16-bit integer to represent any character in the world, that is, any character that can be displayed corresponds to an integer in Unicode.
This method is the escape method of Unicode characters. It is added after \ u to correspond to the Unicode integer.
HexadecimalA Unicode character.
Not only Python,
In a large number of programming languages, two bytes of Unicode are used as the basic character type.. For example, Java and Javascript.
There are many tools that can help you convert text to Unicode. For example, when the 16-level text is written in Java