+ 1

How to write program to get ASCII value of a character??

12th Aug 2019, 10:07 PM
L Attic
L Attic - avatar
5 Réponses
+ 1
#Something like this? chord_dict={} for each in range(33, 127): chord_dict.update({each: chr(each)}) print(chord_dict)
12th Aug 2019, 10:47 PM
Steven M
Steven M - avatar
+ 3
You can use the built-in function ord. Use it on a letter, and you'll get the ASCII code.
12th Aug 2019, 10:23 PM
HonFu
HonFu - avatar
+ 2
ord() function changes a character into ascii print(ord('a')) >>> 97 chr() function changes an ascii into character print(chr(97)) >>> a
13th Aug 2019, 7:24 AM
Shen Bapiro
Shen Bapiro - avatar
+ 1
Thank you so much
12th Aug 2019, 10:43 PM
L Attic
L Attic - avatar
+ 1
Thanks
12th Aug 2019, 10:47 PM
L Attic
L Attic - avatar