strings in Python (newbie)

zif zf_acs at DELETETHIShotmail.com
Wed Mar 12 19:00:23 EST 2003


Hi All,

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).

They require 56 byte stream data (yes Tim, you are right,
this is not a string), and I was able to send and receive
streams using binascii.a2b_hex() and binascii.b2a_hex()
functions. The code is very ugly, but it works.

Further comments will be appreciated.

Regards,
zif

zif <zf_acs at hotmail.com> wrote in message
news:9397bfd5.0303120610.6d7b2f20 at posting.google.com...
> Hi All,
>
> What would be in Python an equivalent to the following C language
> strings:
>
> unsigned char Sconnection[56] = {
>     0, 0, 0, 0, 0, 0, 0, 0,
>     0, 0, 0, 0, 0, 0, 0, 0,
>     0, 0, 0, 0, 0, 0, 0, 0,
>     0, 0, 0, 0, 0, 0, 0, 0,
>     0, 0, 0, 0, 0, 0, 0, 0,
>     0, 0, 0, 0, 0, 0, 0, 0,
>     0, 0, 0, 0, 0, 0, 0, 0 };
>
> unsigned char EstabSession[56] = {
>     8, 0, 1, 0, 0, 0, 0, 0,
>     0, 1, 0, 0, 0, 0, 0, 0,
>     0, 1, 0, 0, 0, 0, 0, 0,
>     0, 0, 0, 0, 0, 0, 1, 0xc0,
>     0, 0, 0, 0, 0x10, 0x0e, 0, 0,
>     1, 1, 0x4f, 1, 0, 0, 0, 0,
>     0, 0, 0, 0, 0, 0, 0, 0 };
>
> Thanks,
> zif






More information about the Python-list mailing list