我有一些文本看起來像這樣:<meta content="http://schema.org/LikeAction" itemprop="interactionType"><meta content="10" itemprop="userInteractionCount"/><span class="post-likes">10 Likes</span></meta></div><div itemprop="interactionStatistic" itemscope="" itemtype="http://schema.org/InteractionCounter">我想找到所有標(biāo)簽的內(nèi)容<span>where class="post-likes",例如上面文本中的第3行。我正在解析的完整文件中有很多 span 標(biāo)簽,所以我只想查看那些具有class="post-likes". 我該怎么做呢?
1 回答

揚帆大魚
TA貢獻(xiàn)1799條經(jīng)驗 獲得超9個贊
你可以這樣完成:
your_spans = soup.findAll("span", {"class": "post-likes"})
添加回答
舉報
0/150
提交
取消