At Wednesday 10/1/2007 07:17, [EMAIL PROTECTED] wrote:

I need to convert a 3 byte binary string like
"\x41\x00\x00" to 3 int values ( (65,0,0) in this case).
The string might contain characters not escaped with a \x, like
"A\x00\x00"

py> [ord(x) for x in "\x41\x00\x00"]
[65, 0, 0]
py> [ord(x) for x in "A\x00\x00"]
[65, 0, 0]
py> "\x41\x00\x00" == "A\x00\x00"
True
py> "\x41\x00\x00" is "A\x00\x00"
True

(The last test is actually irrelevant, however)


--
Gabriel Genellina
Softlab SRL

        

        
                
__________________________________________________ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to