Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #109294
| From | Michael Torrie <torriem@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Efficient handling of fast, real-time hex data |
| Date | 2016-05-31 18:35 -0600 |
| Message-ID | <mailman.60.1464741354.1839.python-list@python.org> (permalink) |
| References | <24081cb5-c5e2-44e4-948f-ecf01ebaf7e6@googlegroups.com> <816aa3d4-352d-0289-f9b5-00cd8798c9ae@gmail.com> |
On 05/31/2016 06:20 PM, jladasky@itu.edu wrote: > So, how can I take the byte sequence <0x01 0x02 0x03 0x04 0x05 0x06 > \n> that Serial.readline() returns to me, and QUICKLY turn it into > three integer values, 258, 772, and 1286? Better yet, can I write > these bytes directly into an array (numpy is an option), since I'm > going to have a lot of them? I think you might want to use the struct module. It's designed for this kind of packing and unpacking: https://docs.python.org/3/library/struct.html > I never thought I would find a task that's easier for me to imagine > doing in C than in Python, but at the moment this is one. Thanks for > any suggestions! Byte and bit twiddling are things that C has always been fast at. But I think Python probably could do it.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Efficient handling of fast, real-time hex data jladasky@itu.edu - 2016-05-31 17:20 -0700
Re: Efficient handling of fast, real-time hex data Michael Torrie <torriem@gmail.com> - 2016-05-31 18:35 -0600
Re: Efficient handling of fast, real-time hex data jladasky@itu.edu - 2016-05-31 18:26 -0700
Re: Efficient handling of fast, real-time hex data Rob Gaddi <rgaddi@highlandtechnology.invalid> - 2016-06-01 01:01 +0000
Re: Efficient handling of fast, real-time hex data jladasky@itu.edu - 2016-05-31 18:23 -0700
Re: Efficient handling of fast, real-time hex data Paul Rubin <no.email@nospam.invalid> - 2016-05-31 21:16 -0700
Re: Efficient handling of fast, real-time hex data Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-01 16:37 +1200
Re: Efficient handling of fast, real-time hex data jladasky@itu.edu - 2016-06-01 11:03 -0700
Re: Efficient handling of fast, real-time hex data Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-06-02 18:50 +1200
Re: Efficient handling of fast, real-time hex data alister <alister.ware@ntlworld.com> - 2016-06-02 08:13 +0000
Re: Efficient handling of fast, real-time hex data Gene Heskett <gheskett@wdtv.com> - 2016-06-02 05:41 -0400
Re: Efficient handling of fast, real-time hex data alister <alister.ware@ntlworld.com> - 2016-06-02 12:30 +0000
csiph-web