I need to read some large files (from 50k to 100k lines), structured in groups separated by empty lines. Each group start at the same pattern \"No.999999999 dd/mm/yyyy ZZZ
It looks good overall, but why do you have the line:
rpi = (line for line in rpi)
You can already iterate over the file object without this intermediate step.