Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28030

Re: issue with struct.unpack

Date 2012-08-28 23:53 +0100
From MRAB <python@mrabarnett.plus.com>
Subject Re: issue with struct.unpack
References <2cc8b390-0b7a-4a0f-ac88-113daf65eba5@googlegroups.com> <mailman.3811.1345922216.4697.python-list@python.org> <f8a1ab56-5387-4e3f-b3ef-2f047973f857@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.3908.1346194406.4697.python-list@python.org> (permalink)

Show all headers | View raw


On 28/08/2012 23:35, 9bizy wrote:
> On Saturday, 25 August 2012 20:16:54 UTC+1, MRAB  wrote:
>> On 25/08/2012 19:34, 9bizy wrote:
>>
>> > I am trying to unpack values from sensor data I am retrieving through
>>
>> > a serial cable, but I get errors while using struct.unpack, how can I
>>
>> > use struct.unpack to unload the data in a readable format?
>>
>> >
>>
>> > I checked the python documentation for struct and I can seen to find
>>
>> > any argument for this.
>>
>> >
>>
>> > I have data = struct.unpack('char',data) but I still get errors
>>
>> >
>>
>> The format strings are described here for Python 3:
>>
>>
>>
>>      http://docs.python.org/3.2/library/struct.html
>>
>>
>>
>> and here for Python 2:
>>
>>
>>
>>      http://docs.python.org/2.7/library/struct.html
>
> I used this documents but they do not explain or provide an example on how to use struct.unpack for sensor data from an external source or even data from a excel sheet.
>
If you want to read from an Excel file you should be using the 'xlrd'
module. You can find it here: http://www.python-excel.org/

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

issue with struct.unpack 9bizy <a.m.akingbulu-11@student.lboro.ac.uk> - 2012-08-25 11:34 -0700
  Re: issue with struct.unpack Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-25 20:12 +0100
  Re: issue with struct.unpack MRAB <python@mrabarnett.plus.com> - 2012-08-25 20:16 +0100
    Re: issue with struct.unpack 9bizy <a.m.akingbulu-11@student.lboro.ac.uk> - 2012-08-28 15:35 -0700
      Re: issue with struct.unpack MRAB <python@mrabarnett.plus.com> - 2012-08-28 23:53 +0100
      Re: issue with struct.unpack Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-28 22:40 -0400
    Re: issue with struct.unpack 9bizy <a.m.akingbulu-11@student.lboro.ac.uk> - 2012-08-28 15:35 -0700
  Re: issue with struct.unpack Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-25 19:31 -0400
    Re: issue with struct.unpack Alexander Blinne <news@blinne.net> - 2012-08-26 14:53 +0200
  Re: issue with struct.unpack MRAB <python@mrabarnett.plus.com> - 2012-08-28 23:49 +0100
    Re: issue with struct.unpack 9bizy <a.m.akingbulu-11@student.lboro.ac.uk> - 2012-08-28 16:01 -0700
    Re: issue with struct.unpack MRAB <python@mrabarnett.plus.com> - 2012-08-29 00:36 +0100
      Re: issue with struct.unpack 9bizy <a.m.akingbulu-11@student.lboro.ac.uk> - 2012-08-28 16:55 -0700
      Re: issue with struct.unpack 9bizy <a.m.akingbulu-11@student.lboro.ac.uk> - 2012-08-28 16:55 -0700
  Re: issue with struct.unpack Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-28 22:31 -0400

csiph-web