Grant Edwards wrote:
> On 2006-03-22, Mark Warburton <[EMAIL PROTECTED]> wrote:
> > Ahh, right. Batteries included! Thanks for the enlightenment. :)
>
> I think that's the third time _today_ that question has been
> answered. Where can we put that information such that you
> would have found it
On 2006-03-22, Mark Warburton <[EMAIL PROTECTED]> wrote:
> Peter Otten wrote:
>> To convert them you need struct.unpack()
>
> Ahh, right. Batteries included! Thanks for the enlightenment. :)
I think that's the third time _today_ that question has been
answered. Where can we put that informatio
Peter Otten wrote:
> To convert them you need struct.unpack()
Ahh, right. Batteries included! Thanks for the enlightenment. :)
--
http://mail.python.org/mailman/listinfo/python-list
You want something like this:
>>> a = '\x1dz'
>>> (ord(a[0])<<8) + ord(a[1])
7546
Each of the two characters represents one byte of a 16-bit integer. It
doesn't matter if they are ascii or hex -- there are still exactly two
bytes in each of your strings.
The ord() function converts a character
"xkenneth" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I've been attempting to write a serial program in python. I talk to
> a custom designed bit of hardware that sends me back groups that are 2
> bytes in length. When i recieve them using either pySerial or USPP i'm
xkenneth wrote:
> I've been attempting to write a serial program in python. I talk to
> a custom designed bit of hardware that sends me back groups that are 2
> bytes in length. When i recieve them using either pySerial or USPP i'm
> not sure how python interprets them. Both of the bytes should be