我知道如何去找到所有的鏈接,但我希望鏈接後立即獲得文本。如何獲得與BeautifulSoup的Python鏈接後的文本?
例如,在給定的HTML:
<p><a href="/cgi-bin/bdquery/?&Db=d106&[email protected]([email protected]((@1(Rep+Armey++Richard+K.))+00028))">Rep Armey, Richard K.</a> [TX-26]
- 11/9/1999
<br/><a href="/cgi-bin/bdquery/?&Db=d106&[email protected]([email protected]((@1(Rep+Davis++Thomas+M.))+00274))">Rep Davis, Thomas M.</a> [VA-11]
- 11/9/1999
<br/><a href="/cgi-bin/bdquery/?&Db=d106&[email protected]([email protected]((@1(Rep+DeLay++Tom))+00282))">Rep DeLay, Tom</a> [TX-22]
- 11/9/1999
...(這個重複的次數)
我想提取與<a href=... >Rep Dreier, David</a>
和相關的[CA-28] - 11/9/1999
對列表中的所有鏈接執行此操作
[findNextSibling](http://stackoverflow.com/a/14062965/111424)?無法在我的網站上安裝BeautifulSoup來測試它。 –