splitting by double newline
Ian
ian.g.kelly at gmail.com
Mon Feb 7 13:02:05 EST 2011
On Feb 7, 10:43 am, Nikola Skoric <n... at fly.srk.fer.hr> wrote:
> Hello everybody,
>
> I'd like to split a file by double newlines, but portably. Now,
> splitting by one or more newlines is relatively easy:
>
> self.tables = re.split("[\r\n]+", bulk)
>
> But, how can I split on double newlines? I tried several approaches,
> but none worked...
self.tables = re.split(r'(?:\r\n){2,}|\r{2,}|\n{2,}', bulk)
More information about the Python-list
mailing list