How to Find ASCII Value of Character using Python?


The ord function in python gives the ordinal value of a character(ASCII). You can use this function to find the ascii codes as follows

Example

s = "Hello"
for c in s:
   print(ord(c))

Output

This will give the output

72
101
108
108
111

Updated on: 05-Mar-2020

130 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements