Converting from long integer to read-only buffer

Ben Andrew Fulton bafulton at cats.ucsc.edu
Thu Jul 5 16:30:38 EDT 2001


Thanks to both responses. That code will come in handy, but I also
reevaluated what I'm doing. Since the byte lengths of my packets are
sometimes a bit strange, I decided to manipulate them as lists of bytes (
['\xFF','\xEE' ] and so forth) and join them when I send the packets to
the serial port. This way I can make sure there aren't any extra high bits
that get sent and everything is a little cleaner (since I can't predict
how many bytes the long int will be). It's also easier to break the packet
into segments, especially if there is a header and terminator common to
all of them. 

-->ben




More information about the Python-list mailing list