林培恒 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 - [email protected]
http://mail.python.org/mailman/listinfo/tutor
