Python 3 Script to Print All ASCII Values of Characters Using Ord() Method and String Module Full Tutorial For Beginners

Python 3 Script to Print All ASCII Values of Characters Using Ord() Method and String Module Full Tutorial For Beginners

 

Welcome folks today in this post we will be printing all ascii values of characters using ord() method and string module in python. All the full source code of the application is shown below.

 

 

Get Started

 

 

In order to get started we need to make an app.py file and copy paste the following code

 

app.py

 

import string

for i in string.ascii_uppercase:
    print("ASCII value of",i,"is",ord(i))

for i in string.ascii_lowercase:
    print("ASCII value of",i,"is",ord(i))

 

 

As you can see in the snippet of python code we are printing all the characters including lowercase and uppercase and their respective ascii values

 

Now if you execute the below command to run this python script

 

python app.py

 

 

Leave a Reply