aat*_*ifh 2 python beautifulsoup
我想嵌入 <p
>标签,哪里有\ r \n\r \n.
"最后,斯里兰卡出现,阻止了他们的首次5-0系列粉饰,并在连续9场ODI胜利中阻止了印度.\ r \n\r \n对于62球,Yuvraj Singh发挥了梦想的敲门声,让印度保持在比赛中尽管小门摔倒在他身边.\ r \n\r \n也许折腾起了很大的作用.这是Mahela Jayawardene在过去的11场比赛中第二次用硬币击败Mahendra Singh Dhoni.\ r \n\r \n它是Jayasuriya为斯里兰卡提供了跳板.\ r \n\r \n烟火可能已经停止了Jayasuriya的解雇,但运行仍然以合理的速度进行."
我尝试使用BeautifulSoup解决这个问题,但无法找到解决方法.任何人都可以通过这一点了解.提前致谢.
''.join('<p>%s</p>' % line for line in text.split('\r\n\r\n'))
# Results:
u"<p>Finally Sri Lanka showed up, prevented their first 5-0
series whitewash, and stopped India at nine ODI wins in a row. </p>
<p>For 62 balls Yuvraj Singh played a dream knock, keeping India in the
game despite wickets falling around him. </p><p>Perhaps the toss played
a big part. This was only the second time Mahela Jayawardene beat Mahendra
Singh Dhoni with the coin in the last 11 occasions. </p>
<p>It was Jayasuriya who provided Sri Lanka with the springboard. </p>
<p>The pyrotechnics may have stopped upon Jayasuriya's dismissal, but
the runs kept coming at a fair pace.</p>"
Run Code Online (Sandbox Code Playgroud)