首页 > 解决方案 > Transform content to String in Python 3 using BeautifulSoup

问题描述

So, I have this:

<td>MBC: <b>0.01 €&lt;/b>   EBC: <b>0.01 €&lt;/b>   SC: <b>0.25 €&lt;/b>   </td>

And I want a string that looks something like this:

MBS: 0.01€, EBC:0.01€, SC:0.25€</p>

How can I take the MBC, EBC and SC out of the ?

Thanks!

标签: pythonhtmlbeautifulsoup

解决方案


您可以使用

text = soup.get_text()
print(text)

推荐阅读