title: How to access span using beautifulSoup?
body: <p>I would like to get the number within the nested  tag. How would I do this?</p>
  
  <p>My code outputs this, but I'd like to get the #40, not the whole two lines:</p>
  
  <pre><code>&lt;span class="rankings-score"&gt;
  &lt;span&gt;#40&lt;/span&gt;
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>from bs4 import BeautifulSoup
  import requests
  import csv
  
  site =  "http://www.usnews.com/education/best-high-schools/national-rankings/page+2"
  
  fields = ['national_rank','school','address','school_page','medal','ratio','size_desc','students','teachers'] 
  
  r = requests.get(site)
  html_source = r.text
  soup = BeautifulSoup(html_source)
  
  table = soup.find('table')    
  rows_list = []      
  
  for row in table.find_all('tr'):                                                                                                                                                                                                                                               
  
      d = dict()
  
      d['national_rank'] = row.find("span", 'rankings-score')
      print d['national_rank']
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>AttributeError: 'NoneType' object has no attribute 'span'
  </code></pre>
  
  <p>when I try this:</p>
  
  <pre><code>d['national_rank'] = row.find("span", 'rankings-score').span.text
  </code></pre>