How to enter a specific & lt; td & gt; in a & lt; tr & gt; with BeautifulSoup


Trying to grab all the names of high schools from the list of high schools in nyc wiki page.

I've written enough of the script to get me all of the info contained within the <tr> tags of the table containing the list of high schools, academic area and entrance criteria - but how can I narrow that down to what I thought would rest within td[0] (which spits back a KeyError) - just the name of the school?

Code I've written thus far:

from bs4 import BeautifulSoup
from urllib2 import urlopen

NYC = ''

html = urlopen(NYC)
soup = BeautifulSoup(, 'lxml')
schooltable = soup.find('table')
for td in schooltable:

Output I receive:

    <td><a href="/wiki/The_Beacon_School" title="The Beacon School">The Beacon School</a></td>
    <td>Humanities &amp; interdisciplinary</td>
    <td>Academic record, interview</td>

Output I'm seeking:

The Beacon School

How about you get the first table on the page, iterate over all rows, except the first header one, and get the first td element for every row. Works for me:

for row in soup.table.find_all('tr')[1:]: