issue with struct.unpack

9bizy a.m.akingbulu-11 at student.lboro.ac.uk
Tue Aug 28 18:35:58 EDT 2012


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.



More information about the Python-list mailing list