Earl,

Try this:

>>> ord('\x00')
0

or:

>>> import struct
>>> struct.unpack('b', '\x00')
(0,)

If you're needing to pull values out of multiple bytes (shorts, longs, floats, etc.), have a look at the struct module. Here's an example:

>>> struct.unpack('f', '\x00\x00(B')
(42.0,)

Hope this helps,
Alan

Earl Eiland wrote:
I'm trying to process the IP packet length field, as recorded by pcap
(Ethereal) and recovered using pcapy.  When I slice out those bytes, I
get a value that shows in '\x00' format, rather than '0x00'.  Neither
int() nor eval() are working.  How do I handle this?

Earl Eiland

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to