Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Python by (3.5k points)

How do I get the ASCII value of a character as an int in Python?

1 Answer

0 votes
by (8.7k points)

 This can be achieved through the use of below two  function:

  • ord(): helps to extract out the int value of the respective character.

  • chr():helps to again convert the int value into its respective character.

For ex:

ord(‘p’)

>>112

chr(112)

>>p

You can also perform operation like

chr(ord(‘p’)-15)

>>a

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...