Newbie - unslicable type error etc

Rodney r.elliott at mech.canterbury.ac.nz
Wed Oct 10 15:32:10 EDT 2001


Hi Everyone,

I started playing with python last night for the first time and I have
run into a problem regarding data types.

I have a large (7MB or so) file of raw hex data (ie values E{0,255})
from which I need to identify a given byte sequence that occurs about
800 000 times within the file.  Once I have found these data fragments
I need to extract them to another file.  My problem is that while I
have been able to open the file and use read(10) etc to look at the
file, I am unable to process it - I tried using input[23:67] (where
'input' is the name of the file I am working with) but python
complained that I was using an unslicable type.

So my question is how do I my file into a format where I am able to
use RE's in python to play with it?  When I input.read(10) it looks
like:

x05\x0A\x45\xA1...

That is raw hex data.  All suggestions most welcome.

 - Rodney



More information about the Python-list mailing list