+ 5
ASCII
In python - If user inputs a alphabet and I want to store its ascii value in a variable how can I do this?
4 Réponses
+ 10
@Pegasus beat me to it. :)
I was going to say
I'm not exactly sure what you mean by input an alphabet, but these two built-in Python functions may be helpful:
ord() returns the ASCII value of a character
chr() returns the character for an ASCII value
e.g.:
print(ord("A")) # outputs 63
print(chr(65)) # outputs A
+ 8
Use the ord(string) function
+ 2
thanks lot
+ 2
ord()