0
我試圖在文檔中獲取特定<td>
標記的內容。目前我的代碼看起來像這樣獲取美容湯中的的內容
對於行的行:
data = row.findAll('td')
for col in data:
if col.string == 'Address':
address = col.findNext('td')
print address
在控制檯上打印地址揭示了這一點:
<td>
Victoria Park Ave & McNicoll Ave, Toronto, ON M1W 3Y3, Canada
<br /> <a class="viewmap-link" href="/c-ViewMap?AdId=299616106">View map</a>
</td>
我想在這<br/>
標記之前得到的一切「地址」我試過address.string
,但它返回「無」。
請點擊旁邊的複選標記以嘗試記住,以接受您的問題的答案。你已經提出了12個問題,只做了兩個問題;你的大部分問題可能都有很好的答案。 – agf