How to get the ASCII value of a character
To get the ASCII value of a character in Python, you can use the built-in ord() function.
To get the ASCII value of a character in Python, you can use the built-in ord() function. The ord() function takes a single character as an argument and returns the corresponding ASCII value.
Here is an example code snippet:
Get the ASCII value of a character in Python
python— editable, runs on the server
Info
Watch a video course: Python - The Practical Guide
You can also use the ord() function with a string, but it will only return the ASCII value of the first character in the string.
Get the ASCII value of the first character of a string in Python
python— editable, runs on the server