strings in Python (newbie)

Richard Brodie R.Brodie at rl.ac.uk
Thu Mar 13 06:16:51 EST 2003


"zif" <zf_acs at DELETETHIShotmail.com> wrote in message
news:TRPba.5637$VT.631305 at news20.bellglobal.com...

> Thanks for the replies. I've just started to learn Python,
> and my first exercise would be to rewrite some old
> command prompt C code wrote for socket communication
> with GE Electric industrial controllers (PLCs).

Funny that: the only time I can recall using the array
module is for another PLC application. Using the (more
general)  struct module to pack heterogenous data packets
is much more common.

import array
estab = [8, 0, 1, 0, 0, 0, 0, 0...]
array.array('B', estab).tostring()

would probably be how I'd code it.







More information about the Python-list mailing list