Char to ASCII and back ?
andrew-pythonlist at puzzling.org
Fri Apr 25 12:02:25 CEST 2003
On Fri, Apr 25, 2003 at 11:40:06AM +0200, Jean-Paul Roy wrote:
> How do you transform a char (or a one-char string) into the integer
> ascii code and back ? Say to code a message.
You can use ord and chr for single characters:
But see also the struct module; it may be what you want for more complicated
packing and unpacking of bytes.
More information about the Python-list