Michael Hoffman wrote:
Greg Lindstrom wrote:
I have a file with varying length records. All but the first record,
that is; it's always 107 bytes long. What I would like to do is strip
out all linefeeds from the file, read the character in position 107
(the end of segment delimiter) and then replace all of the end of
segment characters with linefeeds, making a file where each segment is
on its own line.
Hmmmm... here's one way of doing it:
import mmap
import sys
DELIMITER_OFFSET = 107
N.B. this is a zero-based 107. If you are using one-based coordinates,
then this is actually position 108.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list