【发布时间】:2017-01-29 17:10:48
【问题描述】:
在我试图解析的网站上有如下标签:
<a class="sku" href="http://pl.farnell.com/tdk/c3225x6s0j107m250ac/capacitor-mlcc-x6s-100uf-6-3v/dp/2526286" title="2526286">2526286</a>
我想获取他们的内容列表(这里是 2526286 值)。我怎样才能做到这一点?我试过了
for node in soup.find_all('a', {'class': 'sku'}):
print(node.content)
但它为找到的每个标签返回“无”。
【问题讨论】:
-
Use node.text或node["title"]
标签: python css-selectors beautifulsoup html-parsing