To print ASCII value of any character in python, just follow the program given below. This python program will print all the character along with their ASCII values.
Following python program will print all the 255 character along with their ASCII values:
# Python Program - Print ASCII Values for i in range(1, 255): ch = chr(i); print(i, "=", ch);
Here are all the sample runs of above python program illustrating how to print ASCII values of any character.
If you will run the above program, then all the characters you will see along with its number representing at left side as shown here in below demo output:
Here are some screenshot of the same program with run directly on python shell:
You may also like to learn or practice the same program in other popular programming languages: