a="<img src="hug.jpg/> India is a good country <img src="hug.jpg/> America is also good country "
所以我想在这里是<img/>
标签
答案 0 :(得分:1)
In [104]: from bs4 import BeautifulSoup
In [105]: a="<img src=\"hug.jpg\"/> India is a good country <img src=\"hug.jpg\"/> America is also good country"
In [287]: soup = BeautifulSoup(a,"html.parser")
In [288]: soup.text
Out[288]: ' India is a good country America is also good country'
In [289]: soup.text.strip()
Out[289]: 'India is a good country America is also good country'