Chr, unichr, and ord can be used as character type conversion in Python. here we will talk about the comparison between chr, unichr, and ord character functions in Python, for more information, see chr, unichr, and ord. they can be used as character
This chapter describes the
ord in Python ()The meaning and function of functions, in general,
ord () functionMainly used to return the corresponding characters of the ASCII code, CHR () is mainly used to denote the ASCII code corresponding to the
The Ord () function is mainly used to return the ASCII code of the corresponding character, and Chr () is used mainly to denote the ASCII code corresponding to the character of his input when the number, can be in decimal or hexadecimal.Example:
Talking about the comparison between chr, unichr, and ord character functions in Python, unichrord
Ord is the abbreviation of unicode ordinal, that is, number.
Chr is the abbreviation of character, that is, the character
Ord and chr convert
This function converts a string representation of a character to an integer corresponding to a character typeface, and is suitable for UNICODE characters. For example , ord (' a ') returns an integer , andord (' \u2020 ') returns an integer 8224 .
DescribeThe Ord () function is the Chr () function (for 8-bit ASCII strings) or the UNICHR () function (for Unicode objects), which returns the corresponding ASCII value, or Unicode value, as a parameter with a character (a string of length 1). If
The function ord () and Chr () is a pair of functionally opposite functions, the function ord () is used to return the Unicode code of a single character, and the function Chr () is used to return the character corresponding to the Unicode encoding.>
This article mainly shares Python common operation string function and method summary knot, including the string format output and splicing and other basic knowledge, need friends can refer to the next
For example, a string Python, which is just a
The content of this article
Built-in functions
anonymous functions
Re module
Time Module
Random module
OS Module
SYS module
JSON and Pickle modules
Shelve module
First, built-in functions1.
Use python to design HTML-Based C language syntax to highlight the display program1st-school year semesterCompilation and translation principleCourse schedule reportClass 02 (II)Student ID 19Name: Liu XiaomingScoreInstructor Lu chaohuiI.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.