[Tutor] How can I get ASCII of 'a' and '1'?

bhaaluu bhaaluu at gmail.com
Sat Oct 6 19:36:35 CEST 2007


Here's a handy reference file for ASCII.
(See attached file)
-- 
b h a a l u u at g m a i l dot c o m
http://www.geocities.com/ek.bhaaluu/index.html

On 10/6/07, Kent Johnson <kent37 at tds.net> wrote:
> 林培恒 wrote:
> >     How can I get ASCII for alphabet and number, such as 'a' and '1'. I can get ASCII for character naturally in C but I don't how to in Python.
>
> You can get the character codes using ord():
> In [1]: ord('a')
> Out[1]: 97
> In [2]: ord('1')
> Out[2]: 49
>
> The inverse function is chr():
> In [3]: chr(97)
> Out[3]: 'a'
>
> Kent
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ascii.txt
Url: http://mail.python.org/pipermail/tutor/attachments/20071006/6ef32be8/attachment.txt 


More information about the Tutor mailing list