Languages
[Edit]
EN

Python - convert character to ASCII code

0 points
Created by:
Faith-W
503

In this article, we would like to show you how to convert characters to ASCII code in Python.

Quick solution:

character = 'a'
unicode = ord(character)

print(unicode)  # 97

 

Practical example

In this example, we use ord() function to return the number representing the ASCII code of a specified character.

character = 'a'
unicode = ord(character)

print(unicode)  # 97

Output:

97

References

Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Python - string (popular problems)

Python - convert character to ASCII code
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join