I imaging this is going to be a simple task but I can’t find what I am looking for exactly in previous StackOverflow questions to here goes…
I have large text files in a proprietry format that look comething like this:
:Entry
- Name
John Doe
- Date
20/12/1979
:Entry
-Name
Jane Doe
- Date
21/12/1979
And so forth.
The text files range in size from 10kb to 100mb. I need to split this file by the :Entry delimiter. How could I process each file based on :Entry blocks?
You could use itertools.groupby to group lines that occur after
:Entryinto lists:yields
Or, to process the groups, you don’t really need to convert
groupto a list: