Sander Sweers wrote:
2009/7/18 Che M <pine...@hotmail.com>:
table = soup.find("table","dataTable tm10") #find the table
tbody = table.find("tbody") #find the table's body
You can do this in one step.
tbody = soup.find('tbody')
Yeah, but what if the document contains multiple tables, and you want
explicitely the one with the class 'dataTable tm10'?
In such a case it doesn't hurt to progressively narrow down on the
wanted element.
It also makes the scrape code more robust against page changes. Someone
could add an extra table to the start of the page to host a search box,
for example.
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor