From here:

The function ord() gets the int value of the char. And in case you want to convert back after playing with the number, function chr() does the trick.

>>> ord('a')
97
>>> chr(97)
'a'
>>> chr(ord('a') + 3)
'd'
>>>

In Python 2, there was also the unichr function, returning the Unicode character whose ordinal is the unichr argument:

>>> unichr(97)
u'a'
>>> unichr(1234)
u'\u04d2'

In Python 3 you can use chr instead of unichr.


ord() - Python 3.6.5rc1 documentation

ord() - Python 2.7.14 documentation

Answer from Matt J on Stack Overflow
🌐
GeeksforGeeks
geeksforgeeks.org › competitive programming › program-print-ascii-value-character
Program to print ASCII Value of a character - GeeksforGeeks
Below are few methods in different programming languages to print ASCII value of a given character : Python provides the built-in ord() function to get the ASCII value of a character.
Published   November 13, 2025
🌐
w3resource
w3resource.com › python-exercises › python-basic-exercise-86.php
Python: ASCII value of letter in Python - w3resource
May 17, 2025 - Write a Python program to find the ASCII values of all characters in a string.
🌐
Portland State University
web.cecs.pdx.edu › ~lmd › cs199 › notes-week4.htm
ASCII Character set
The chr function in Python will convert a number into it’s ASCII character.
🌐
Vultr
docs.vultr.com › python › examples › find-ascii-value-of-character
Python Program to Find ASCII Value of Character | Vultr Docs
December 5, 2024 - This example demonstrates the ASCII value for extended characters like 'á', 'ê', and 'ô', showing their respective Unicode points [225, 234, 244]. Using Python to find the ASCII value of characters is straightforward with the ord() function.
Find elsewhere
🌐
Python
docs.python.org › 3 › library › curses.ascii.html
curses.ascii — Utilities for ASCII characters
The following two functions take either a single-character string or integer byte value; they return a value of the same type. ... Return the ASCII value corresponding to the low 7 bits of c.
🌐
Javatpoint
javatpoint.com › python-ascii-value-of-character
Python Program To Find ASCII value of a character
Python ASCII Value of Charcter for beginners and professionals with programs on basics, controls, loops, functions, native data types etc.
🌐
W3Schools
w3schools.com › python › ref_func_ascii.asp
Python ascii() Function
Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Bootcamp Python Certificate Python Training ... The ascii() function returns a readable version of any object (Strings, Tuples, Lists, etc).
🌐
GeeksforGeeks
geeksforgeeks.org › python › ascii-in-python
ascii() in Python - GeeksforGeeks
January 24, 2026 - Both repr() and ascii() return string representations of Python objects, but they differ in handling non-ASCII characters. repr() keeps Unicode characters intact, while ascii() escapes them to ensure ASCII-only output. ASCII Values Alphabets · Python String ·
🌐
PythonForBeginners.com
pythonforbeginners.com › home › ascii value in python
ASCII value in Python - PythonForBeginners.com
December 14, 2021 - In the ASCII encoding, each character has been assigned a numeric value between 0 to 127. This numeric value associated to a character is called the ASCII value of the character.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-convert-string-list-to-ascii-values
Convert String List to ASCII Values - Python - GeeksforGeeks
January 19, 2026 - If we need a flat list of ASCII values instead of a nested list, we can use itertools.chain(). ... This method is useful when we want a flat list instead of a list of lists. If we want to keep track of original characters, we can store them in a dictionary. ... Instead of just converting characters, this stores them as {char: ASCII} pairs.
🌐
Reddit
reddit.com › r/learnpython › how to return ascii character(32-126) numerical value
r/learnpython on Reddit: How to Return ASCII Character(32-126) Numerical Value
October 3, 2023 -

I know that the PYTHON function chr(dec#) returns the ASCII character indicated by the dec#. My question is how would I return the specific decimal# of a selected character❓ Example: Open a FILE, read each character sequentially and return/assign the character's numerical ascii value (32-126) to variable as each character is read. The variable will then be used to create an ascii character value list of the input file.

Is there a PYTHON function similar to chr(dec#), that would return a numerical value of a specific ascii character❓

Thank You for any assistance.

🌐
Replit
replit.com › home › discover › how to print the ascii value in python
How to print the ASCII value in Python | Replit
February 12, 2026 - The chr() function is the inverse of ord(), turning an integer back into its character representation. It's perfect for when you need to reconstruct a string from a list of ASCII values. The code iterates through the ascii_values list using a generator expression.
🌐
Delft Stack
delftstack.com › home › howto › python › python char to ascii
How to Get ASCII Value of a Character in Python | Delft Stack
March 4, 2025 - One of the simplest and most effective ways to get the ASCII value of a character in Python is by using the built-in ord() function. This function takes a single character as an argument and returns its corresponding ASCII (or Unicode) integer value.
🌐
PREP INSTA
prepinsta.com › home › python program › python program to find ascii values of a character
ASCII value of character in python | Programming | PrepInsta
October 14, 2022 - # user input Char = 'z' # convert Char to Ascii value Ascii_val = ord(Char) # print Value print('The ASCII value of', Char, 'is', Ascii_val)
🌐
Reddit
reddit.com › r/learnpython › hello people of python, i have a lil question about ascii values
r/learnpython on Reddit: Hello people of python, I have a lil question about ascii values
June 27, 2021 - I found the answer in 3 seconds by googling “python character of an ascii value”. You use ord() (ordinal) to find the character represented by a given integer, and chr() to do the inverse.
🌐
WsCube Tech
wscubetech.com › resources › python › programs › ascii-character
Python Program to Find ASCII Value of Character
August 29, 2025 - Learn how to create a Python program to find the ASCII value of a character with this simple guide. Perfect for beginners looking to understand ASCII in Python.