我使用BeautifulSoup从html数据表中获取信息。特别是,我正在尝试获取href=。。。在以下行中:
<a class="block" href="/post/BpkL7ColOVj" style="background-image: url(https://scontent-ort2-2.cdninstagram.com/vp/09e1b7436c9125092433c041c35c1eaa/5BDB064D/t51.2885-15/e15/s480x480/43913877_2130106893692252_5245480330715053223_n.jpg)">
soup.find_all('a', attrs={'class':'block'})
有没有其他方法可以使用BeautifulSoup获取href中包含的内容
谢谢
只需使用
['attribute_name']
这将按属性名称获取属性您还可以使用
css selector
,我认为这更简单:相关问题 更多 >
编程相关推荐