issue with struct.unpack

MRAB python at mrabarnett.plus.com
Tue Aug 28 18:53:29 EDT 2012


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/



More information about the Python-list mailing list