BeautifulSoup 根据文本内容反查标签

 pattern = re.compile("test")
 element = soup_object.find('a', text=pattern).parent

 http://stackoverflow.com/questions/866000/using-beautifulsoup-to-find-a-html-tag-that-contains-certain-text

 

posted @ 2016-04-26 14:26  藥師  阅读(3520)  评论(0编辑  收藏  举报