oyster writes:

> I have a long text, which should be splitted into some sections, where
> all sections have a pattern like following with different KEY.

itertools.groupby, if you know how to extract a key from a given line.

> And the /n/r can not be used to split

Yet you seem to want to have each line as a unit? You could group
lines straight from some file object using itertools.groupby and then
''.join each group.

(It's \n and \r, and \r\n when they are both there, but you can just
let Python read the lines.)
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to