how to read serial stream of data [newbie]
jeandupont115 at gmail.com
Tue Feb 7 15:46:28 CET 2012
On 7 feb, 15:04, Heiko Wundram <modeln... at modelnine.org> wrote:
> Am 07.02.2012 14:48, schrieb Antti J Ylikoski:
> > On 7.2.2012 14:13, Jean Dupont wrote:
> >> ser2 = serial.Serial(voltport, 2400, 8, serial.PARITY_NONE, 1,
> >> rtscts=0, dsrdtr=0, timeout=15)
> > In Python, if you want to continue the source line into the next text
> > line, you must end the line to be continued with a backslash '\'.
> Absolutely not true, and this is bad advice (stylistically).
> When (any form of) brackets are open at the end of a line, Python does
> not start a new command on the next line but rather continues the
> backeted content.
> ser2 = serial.Serial(voltport, 2400, 8, serial.PARITY_NONE, 1,
> rtscts=0, dsrdtr=0, timeout=15)
> is perfectly fine and certainly the recommended way of putting this.
> Adding the backslash-continuation is always _possible_, but only
> _required_ when there are no open brackets.
> x = "hello" \
> " test"
> is equivalent to:
> x = ("hello"
> " test")
> in assigning:
> x = "hello test"
> --- Heiko.
Hello to all who gave advice concerning the line continuation, in fact
this was not a real problem but happened by accident
copying and pasting my program lines. Advice concerning the empty file
would of course also be very much appreciated.
More information about the Python-list