Urgent: "\" in strings?

Alan Gauld alan.gauld at gssec.bt.co.uk
Tue Aug 8 08:52:03 EDT 2000


> an image returns a string such as:
> 
> '\000\000\001\002' etc

Thats binary data. The 3 digits after the \ are octal 
so \000 is 0 etc. What you have is 2 bytes: 0x00,0x0A

> which is not that weird until you do a s[0] and it returns:
> 
> '\000' instead of '\
> 
> How do I convert this string to numbers?

You probably need to use the unpack(?) function in the 
struct module... but you'll need to know what the original 
data looked like to make sense of it!

> PS - Sorry about the urgency - got a presentation tomorrow and this is
> the final link in getting my demo working. :(

Alan G
-- 
=================================================
This post represents the views of the author 
and does not necessarily accurately represent 
the views of BT.



More information about the Python-list mailing list