How to represent a sequence of raw bytes

Michiel Overtoom motoom at xs4all.nl
Sun Dec 21 21:27:36 EST 2008


On Monday 22 December 2008 03:23:03 Steven Woody wrote:

> 2.  char buf[] = {0x11, 0x22, 0x33, ... }
>
> What's the equivalent representation for above in Python?

>>> buf="\x11\x22\33"
>>> for b in buf: print ord(b)
...
17
34
27
>>>


Greetings, 

-- 
"The ability of the OSS process to collect and harness 
the collective IQ of thousands of individuals across 
the Internet is simply amazing." - Vinod Vallopillil 
http://www.catb.org/~esr/halloween/halloween4.html



More information about the Python-list mailing list