如何使用beauthoulsoup在文本中嵌入p标记?

2024-09-30 14:37:57 发布

您现在位置:Python中文网/ 问答频道 /正文

我想将<p>;标记嵌入到有标记的位置\r\n\r\n

“u”最终斯里兰卡出现了,阻止了他们的第一个5-0系列粉饰,并阻止了印度在奥迪九连胜。\r\n\r\n Yuvraj Singh打出了一个梦幻般的敲门球,让印度队在比赛中保持领先,尽管他周围的边门被击倒。\r\n\r\n掷骰子起了很大作用。这是马赫拉·贾亚沃登在过去11次中第二次用这枚硬币击败马亨德拉·辛格·多尼。\r\n\r\n正是贾亚苏里亚为斯里兰卡提供了跳板。\r\n\r\nJayasuriya被解雇后,烟火可能已经停止了,但奔跑的速度仍然很快。”

我试着用beauthoulsoup解决这个问题,但找不到出路。任何人都可以透过灯光看到这个。提前谢谢。在


Tags: 标记gt硬币速度灯光跳板领先singh
1条回答
网友
1楼 · 发布于 2024-09-30 14:37:57
''.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>"

相关问题 更多 >