In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains the "introduction and example usage of Python ord function ()". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the introduction and example usage of Python ord function ()".
Ord function in python
Python ord () function (Python ord () function)
Ord () function is a library function in Python, it is used to get number value from given character value, it accepts a character and returns an integer I.E. It is used to convert a character to an integer I. e. It is used to get the ASCII value of a given character.
The ord () function is a library function in Python that gets a numeric value from a given character value. It accepts a character and returns an integer, which is used to convert a character to an integer, that is, to get the value of a given character in ASCII.
Syntax:
Syntax:
Ord (character)
Parameter:character-character value to be converted in an integer value.
Parameter: the character value to be converted to an integer value by character-.
Return value: str-returns an integer value of given character.
Return value: str-returns the integer value of a given character.
Example:
Example:
Input:val = 'A'print (ord (val)) Output:65
Python code to convert a character into an integer (ASCII value)
Python code converts characters to integers (ASCII values)
# python code to demonstrate an example# of ord () function val = 'A'print ("ASCII code of", val, "is =", ord (val)) val =' x'print ("ASCII code of", val, "is =", ord (val)) val ='@ 'print ("ASCII code of", val, "is =", ord (val) val =' 8'print ("ASCII code of", val, "is =", ord (val))
Output
Output quantity
ASCII code of An is = 65
ASCII code of x is = 120
ASCII code of @ is = 64
ASCII code of 8 is = 56
Thank you for your reading, the above is the content of "introduction and example usage of Python ord function ()". After the study of this article, I believe you have a deeper understanding of the introduction and example usage of Python ord function (), and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.