I am first going to point out that I am new to all of this but struggling with trying to get to a nested tables cells.
Here is the square footage field I am trying to get to down around line 282: view-source: http://services.wakegov.com/realestate/Account.asp?id=0355891
'square_feet': soup.findAll('table')[10].findAll('tr')[15].get_text().strip(),
The error I receive is:
IndexError: list index out of range
一种更易读,更简单的方法是依靠参数标签-换句话说,通过文本查找元素,获取父td
元素并找到下一个td
兄弟元素,例如:
soup.find(text="Heated Area").find_parent('td').find_next_sibling("td").get_text()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.