Python - how to separate paragraphs from text?

后端 未结 5 1035
花落未央
花落未央 2020-12-21 13:05

I need to separate texts into paragraphs and be able to work with each of them. How can I do that? Between every 2 paragraphs can be at least 1 empty line. Like this:

<
5条回答
  •  生来不讨喜
    2020-12-21 13:25

    this is worked for me:

    text = "".join(text.splitlines())
    text.split('something that is almost always used to separate sentences (i.e. a period, question mark, etc.)')
    

提交回复
热议问题