以下是XML文件的项标记的内容。如何使用BeautifulSoup提取media:content
标记
<item>
<title>How Kerala is preparing for monsoon amid the COVID-19 pandemic</title>
<link/>https://www.thenewsminute.com/article/how-kerala-preparing-monsoon-amid-covid-19-pandemic-125007
<description>Usually, Kerala begins its procedure for monsoon preparedness by January. This year, however, the officials got busy with preparing for a health crisis instead. “Kerala works six months and fights the monsoon in the other six months,” says Sekhar Kuriakose, member secretary of the Kerala State Disaster Management Authority (KSDMA). Usually, Kerala begins its monsoon preparedness by January, even before the India Meteorological Department (IMD) makes its first long-range forecast for southwe...</description>
<pubdate>Thu, 21 May 2020 10:30:00 GMT</pubdate>
<guid>https://www.thenewsminute.com/article/how-kerala-preparing-monsoon-amid-covid-19-pandemic-125007</guid>
<media:content medium="image" url="https://www.thenewsminute.com/sites/default/files/Kerala-rain-trivandrum-1200.jpg" width="600"></media:content>
</item>
您的问题可能是BS4如何使用您正在使用的解析器后端处理名称空间。指定“LXML”而不是“XML”允许您使用find()和find_all(),正如您在本例中所期望的那样
让
t
与您提供的XML一起成为字符串产生
但是,通过使用LXML解析器,它能够找到以下元素:
产生
相关问题 更多 >
编程相关推荐