ASCII characters in my hex output
francisgavila at yahoo.com
Mon Jan 5 22:33:17 CET 2004
nuvodido wrote in message ...
>I am using pyserial to work with a device on my serial port. the
>output is a mixture of ASCII and hex:
>I need conver the \x00* nuber in to decimal. Is there way to
>convter this value striat forward?
You're not being specific enough. Here are some things to look at:
Pyserial for your serial port-ing needs.
Struct module for C-structs. Array module for homogenous binary data.
Have a look also at ctypes and xstruct (both external modules).
chr() and ord() builtins; shift and binary arithmetic operators.
I suspect what you are asking is something like:
struct.unpack('=bh', '\x10\x00*') -> (16, 10752)
But again, how can I know?
More information about the Python-list