|
Nagy László |
at Feb 18, 2003 at 9:31 am
|
⇧ |
| |
I'm currently trying to receive data from a socket with
data = mysock.recv(LENGTH)
the fisrt byte of data is the length of data to receive.
If I print the length I get : print data[0] -> "\x04"
How can I "cast" it in order to handle it as an int whose value is 4 ?
thanks
You can use the 'ord' and 'chr' functions to convert between a character
and its code.
They are using 8bit integers in range(256). If you want to send bigger
numbers you
can either
1. Create your own conversion function (e.g. send more digits with
radix 256)
2. Use the Pickle or cPickle to temporary convert the object into a
string
Laci 1.0
From j.heylenAToption.com Tue Feb 18 10:38:06 2003
From: j.heylenAToption.com (Jan Heylen)
Date: Tue, 18 Feb 2003 10:38:06 +0100
Subject: CIM/WMI pcmcia power cycle with python
Message-ID: <
[email protected]>
Hi,
I was wondering if it is possible to power off/on a pcmcia slot/card
from python. Most likely with the wmi interface?
If it is possible, has somebody done it? Can I see some sample code
somewhere? Some tips?
thx
Jan
Jan Heylen
Firmware Engineer
mailto: j.heylenAToption.com
http://www.option.com