circular iteration

2005-01-21 Thread Flavio codeco coelho
hi, is there a faster way to build a circular iterator in python that by doing this: c=['r','g','b','c','m','y','k'] for i in range(30): print c[i%len(c)] thanks, Flávio -- http://mail.python.org/mailman/listinfo/python-list

Re: Python serial data aquisition

2005-01-12 Thread Flavio codeco coelho
[EMAIL PROTECTED] (Flavio codeco coelho) wrote in message news:<[EMAIL PROTECTED]>... > struct.unpack returns a tuple of values represented by a string(the > output of the read command) packed according to the format specified > by ">BB" > In this forma st

Re: Python serial data aquisition

2005-01-11 Thread Flavio codeco coelho
[EMAIL PROTECTED] (Bengt Richter) wrote in message news:<[EMAIL PROTECTED]>... > On 9 Jan 2005 14:13:28 -0800, [EMAIL PROTECTED] (Flavio codeco coelho) wrote: > > >Hi, > > > >I am using pyserial to acquire data from an A/D converter plugged to > >my serial

Checking for X availability

2005-01-11 Thread Flavio codeco coelho
I have a program that uses pythondialog for its UI. Pythondialog is a wrapper of the shell dialog and xdialog libs. But I would like for it to switch between using Dialog ( when X is not available ) and xdialog (when X is available) So my question is: how can I check for the availability of X?

Re: Python serial data aquisition

2005-01-11 Thread Flavio codeco coelho
Paul Rubin wrote in message news:<[EMAIL PROTECTED]>... > or something like that. Hi Paul, thanks for your answer. I Noticed, however that although your solution is almost identical to that of Michael (earlier in the thread) your masking for the second byte is differen

Re: Python serial data aquisition

2005-01-11 Thread Flavio codeco coelho
[EMAIL PROTECTED] (Michael Fuhr) wrote in message news:<[EMAIL PROTECTED]>... > If the actual byte and/or bit order is different then you'll have > to modify the expression, but this should at least give you ideas. Hi Michael, It all looks pretty god but there is a couple of things I still don't

Re: Python serial data aquisition

2005-01-10 Thread Flavio codeco coelho
[EMAIL PROTECTED] (Michael Fuhr) wrote in message news:<[EMAIL PROTECTED]>... > If the actual byte and/or bit order is different then you'll have > to modify the expression, but this should at least give you ideas. Thanks Michael and Steve, I'll put your Ideas to the test ASAP, meanwhile, could y

Python serial data aquisition

2005-01-09 Thread Flavio codeco coelho
Hi, I am using pyserial to acquire data from an A/D converter plugged to my serial port. my hardware represents analog voltages as 12bit numbers. So, according to the manufacturer, this number will be stored in two bytes like this; |-bits(1-8)---| Byte1: x x x n1