Python 在BeautifulSoup中查找2个属性

Python 在BeautifulSoup中查找2个属性,python,beautifulsoup,Python,Beautifulsoup,以下是HTML的一部分: <td class="team-name"> <div class="goat_australia"></div> <a href="http://www.waaaaa.com.au/g-smith/australia/melbourne">Melbourne</a><br /> Today &l

以下是HTML的一部分:

<td class="team-name">
<div class="goat_australia"></div>
<a href="http://www.waaaaa.com.au/g-smith/australia/melbourne">Melbourne</a><br />
                            Today
                        </td>
<td class="team-name">
<div class="goat_australia"></div>
<a href="http://www.waaaaa.com.au/g-smith/australia/sydney">Sydney</a><br />
                            Tomorrow
                        </td>
如果我运行这个,什么都不会返回

如果我拿出最后一个If语句

print soup2
我收回了所有的td标签,但有些有“今天”,有些有“明天”等等

有什么建议吗?是否有方法向soup.findAll函数添加2个属性


我还尝试在findAll上运行findAll,但没有成功。

使用您当前获得的代码结构,尝试使用嵌入式findAll查找“今日”:

for entry in soup2:
    if entry.findAll(text=re.compile("Today")):
        print entry

使用当前代码的结构,尝试使用嵌入式findAll查找“今日”:

for entry in soup2:
    if entry.findAll(text=re.compile("Today")):
        print entry

你应该接受他的回答,这样他才能因帮助你而获得应有的荣誉。你应该接受他的回答,这样他才能因帮助你而获得应有的荣誉。