View Single Post
Old May 23rd, 2006, 11:09 AM   #123
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Close, but not quite. "findParent" finds the first parent that matches a certain tag. It does not return a list, so indicies (like [2]) won't work on it.

Instead, you need to find the 3rd matching piece of text. This means you have to use fetchText (which gets a list of all matches) instead of firstText (which gets the first match), and apply an index to that.

Or, to put it another way:
soup.firstText("Company")
Is the same as:
soup.fetchText("Company")[0]
Hopefully, you should be able to guess now what code you need.
Arevos is offline   Reply With Quote