Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'argument': 0.04; 'mrab': 0.05; 'subject:skip:s 10': 0.05; 'python': 0.09; 'to:addr:comp.lang.python': 0.09; 'unpack': 0.09; 'cc:addr:python- list': 0.10; 'format?': 0.16; 'readable': 0.16; 'retrieving': 0.16; 'subject:issue': 0.16; 'unload': 0.16; 'wrote:': 0.17; 'trying': 0.21; 'struct': 0.22; 'cc:2**0': 0.23; 'example': 0.23; 'errors': 0.23; 'cc:no real name:2**0': 0.24; 'external': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'values': 0.26; 'source': 0.29; 'this.': 0.29; 'checked': 0.30; 'url:python': 0.32; 'excel': 0.33; 'received:google.com': 0.34; 'described': 0.35; 'received:209.85': 0.35; 'explain': 0.36; 'but': 0.36; 'url:org': 0.36; 'url:library': 0.36; 'subject:with': 0.36; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'url:docs': 0.38; 'provide': 0.62; 'here': 0.65; 'serial': 0.66; 'august': 0.66 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=path:newsgroups:date:in-reply-to:complaints-to:injection-info :nntp-posting-host:references:user-agent:x-google-web-client :x-google-ip:mime-version:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=FeSLW9XaFHgTUTjS8Q7OyPmU749NtryN188L3zcfuKA=; b=SuPLfnoST2o0H0ZOoN9F2eyoZC6o0d2DYkffPL52eLqsPTc9LMpTdZz60i2xrD3Own rR/Bb1GY86NLhkp35M4J5+sNbq3yQ8pN2qt8A3kpircTLSa0vZ615OW6L8yp6IgiRxQi 00BVSic/MXGoMSz8lpYlIGCu1d9Dxe+bTCUNanNR3nsxShXOpbkTknk6OqEri00Nvsml 0tEo/YaX1MOZqWR9phivBvW9WZ7Aw4wSKwq9tUoyCVuQnvA2uamxHmbp+wFp6aXFy8rx KW7fSlIClTzEKBychRomX3BWz/75isDcLIb8wXJ6bIEtgp0sGHAe8qo8tR07euLXLiMC cFCw== Newsgroups: comp.lang.python Date: Tue, 28 Aug 2012 15:35:58 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=86.26.195.253; posting-account=q-eYcwkAAABs2oHZOqATxktPXe8hl2vw References: <2cc8b390-0b7a-4a0f-ac88-113daf65eba5@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 86.26.195.253 MIME-Version: 1.0 Subject: Re: issue with struct.unpack From: 9bizy To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQlq+WAfwPIElq68nJiVLLnxAtnDMubhzUvWDZSxlJloBMvWIehOK4ZtYFPtwaBCRj4LVBeF Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 36 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1346194008 news.xs4all.nl 6938 [2001:888:2000:d::a6]:32991 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28028 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.