python regular expression to split paragraphs

前端 未结 5 612
执笔经年
执笔经年 2021-01-19 01:40

How would one write a regular expression to use in python to split paragraphs?

A paragraph is defined by 2 linebreaks (\\n). But one can have any amount of spaces/ta

5条回答
  •  無奈伤痛
    2021-01-19 02:30

    FYI: I just wrote 2 solutions for this type of problem in another thread. First using regular expressions as requested here, and second using a state machine approach which streams through the input one line at a time:

    https://stackoverflow.com/a/64863601/5201675

提交回复
热议问题