psSerial: how to write a single byte value to the serial port?

SoftwareTester mr_ravi_patil at yahoo.com
Wed Nov 17 22:09:26 EST 2004


"Diez B. Roggisch" <deetsNOSPAM at web.de> wrote in message news:<cngalv$t5j$05$1 at news.t-online.com>...
> > I assume the string print ser.write() will append null characters to the
> > end.
> 
> Why do you assume that? Its not said anywhere, and its wrong. A string
> consists only of the characters you can "see" - if python usues C
> convention for 0-termination or othear means is an implementation detail
> none of your concern.
> 
> > byte = chr(0x40)
> > ser.write(byte)
>  
> >>> type(byte)
> <type 'str'>
> 
> Its a string as well.

I am concerned because I do not know the effect of writing null
character to the device connected to the serial byte.

I wish to send a single byte to the serial port and nothing more.

Thanks.



More information about the Python-list mailing list