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


/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to