Virtual COM port on Linux

Stuart Jansen sjansen at
Mon Mar 15 12:00:45 MDT 2010

On Mon, 2010-03-15 at 11:40 -0600, Dave Smith wrote:
>    f=open("/dev/ttyUSB0","wb")
>    for byte in [0xff, 0x01, 0x00]:
>      f.write(chr(byte))
>    f.close()
> (Is there a one-liner to do this?)

$ python -c "with open('/tmp/foo', 'w') as f: map(f.write, [chr(x) for x
in (0xff, 0x01, 0x00)])"

$ od -t x1 /tmp/foo 

Does this mean I'm going to be kicked out of the Pythonista club?

"XML is like violence: if it doesn't solve your problem, you aren't
using enough of it." - Chris Maden

More information about the PLUG mailing list