I have a file consisting in three parts:
- Xml header (unicode);
- ASCII character
29
(group separator); - A numeric stream to the end of file
I want to get one xml string from the first part, and the numeric stream (to be parsed with struct.unpack
or array.fromfile
).
Should I create an empty string and add to it reading the file byte by byte until I find the separator, like shown here?
Or is there a way to read everything and use something like xmlstring = open('file.dat', 'rb').read().split(chr(29))[0]
(which by the way doesn't work) ?
EDIT: this is what I see using a hex editor: the separator is there (selected byte)