HOW TO GET ASCII VALUE OF CHAR IN PYTHON
In this article, we will find how to get ascii value of char in python. If you are looking for “how to print ascii value in python”, this article will also guide you for the same.
ASCII (American Standard Code for Information Interchange) is a character encoding standard for text files. Each symbol in the character set can be represented by a Decimal value ranging from 0 to 127, as well as equivalent Hexadecimal and Octal values.
To find the ASCII value of a character, we can use the built-in function ord() function, which accepts a char (string of length 1) as an argument and returns the unicode code point for that character.
inp = input("Enter a character: ") print("ASCII is ", ord(inp))
Output:
Enter a character: 2 ASCII is 50
Subscribe
Login
Please login to comment
0 Discussion