Find Next ASCII Character in Python


Next ASCII Character

To get the next ASCII character, for a given character, we use ord() builtin function to get the ASCII value of given character, increment it by one, and then use chr() builtin function to get the character for this incremented ASCII value.


In this example, we will read a character (a string of length one) into x from user, and find the next ASCII character.

Python Program

x = input('enter a character : ')
ascii = ord(x)
next_char = chr(ascii + 1)
print('next character :', next_char)


enter a character : r
next character : s


In this tutorial of Python Examples, we learned how to get the next ASCII character for a given character.

Related Tutorials

Code copied to clipboard successfully 👍