Hello,

I'm not a Tutor but I found this wich could help you:

Source:
http://mail.python.org/pipermail/tutor/2003-March/021123.html

To convert character data to integers, you can use the ord()
function, and to convert a number to hex notation you can use the
hex() function.

Example:

>>> data ="" "hello"
>>> for char in data:
>>> print hex(ord(char))

Note that hex() returns a string, not a number.

francois

On 18/08/05, nephish <[EMAIL PROTECTED]> wrote:
Hey there,
i am using the serial module and trying to get some info over an RS232
port. Seems to be comming in ok, but when i print it out, its in ASCII
instead of hex. is there a way to have python read serial in hex bytes
instead of ASCII ?
thanks.
shawn
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to