In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-19 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.