擅长:python、mysql、java
<p>可以按如下方式在双换行线上拆分:</p>
<pre><code>paragraphs = re.split(r"\n\n", DATA)
</code></pre>
<p><strong>编辑:</strong>要将段落捕获为匹配段落,以便获取其起点和终点,请执行以下操作:</p>
<pre><code>for match in re.finditer(r'(?s)((?:[^\n][\n]?)+)', DATA):
print match.start(), match.end()
# Prints:
# 0 214
# 215 298
# 299 589
</code></pre>