how to read serial stream of data [newbie]

Antti J Ylikoski antti.ylikoski at tkk.fi
Tue Feb 7 12:44:59 EST 2012


On 7.2.2012 16:02, Peter Otten wrote:
> Antti J Ylikoski wrote:
>
>> 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 '\'.
>>
>> So you should write:
>>
>> ser2 = serial.Serial(voltport, 2400, 8, serial.PARITY_NONE, 1, \
>> rtscts=0, dsrdtr=0, timeout=15)
>>
>> and analogously.
>>
>> Hope that this will help.  Andy.
>
> This is wrong. A line with an open parenthesis is continued automatically:
>
>>>> zip("abc",
> ... "def")
> [('a', 'd'), ('b', 'e'), ('c', 'f')]
>>>> ("abc"
> ... "def")
> 'abcdef'
>>>> 1 + 2 + (
> ... 3)
> 6
>
>

Thank you for correcting me.  Andy.




More information about the Python-list mailing list