title: How to get each value inside <li> with <span> tag BeautifulSoup
body: <p>I have an HTML document which looks like below, <em>self.soup</em> is BeautifulSoup object. I tried to scrape data inside list element. List element looks like below:</p>
  
  <pre><code> &lt;ul class="list-group"&gt;
          &lt;li class="list-group-item"&gt;
             &lt;span class="strong"&gt;Name&lt;/span&gt;
             &lt;span class="pull-right"&gt;Piter&lt;/span&gt;
          &lt;/li&gt;
          &lt;li class="list-group-item"&gt;
             &lt;span class="strong"&gt;Year&lt;/span&gt;
             &lt;span class="pull-right"&gt;2017&lt;/span&gt;
          &lt;/li&gt;
   &lt;/ul&gt;
  </code></pre>
  
  <p>python file <strong>scrape.py</strong></p>
  
  <pre><code>  #person is a array
    need = { 'Name' : 'name',
             'Year' : 'year'
    }
  </code></pre>
  
  <p><em>First tried</em></p>
  
  <pre><code>  specs = self.soup.select("ul.list-group li.list-group-item") 
    if  len(specs) &gt; 0 :
          for data in specs :
              text = data.get_text()
              if need.has_key( data[0].strip()) : 
                   if need[ data[0].strip() ] not in person or person[ need[ data[0].strip() ] ] == '':
                      person[ need[ text[0].strip() ] ] = text[1].strip()
  </code></pre>
  
  <p>First Error </p>
  
  <pre><code> File "scraper.py", line 68, in scrape
      if need.has_key( data[0].strip()) : 
   File "build/bdist.linux-x86_64/egg/bs4/element.py", line 1011, in__getitem__
   KeyError: 0
  </code></pre>
  
  <p><em>Second tried</em></p>
  
  <pre><code>  specs = self.soup.select("ul.list-group li.list-group-item")
    if  len(specs) &gt; 0 :
          for data in specs :
              text = data.get_text()
              if need.has_key( data[0].strip()) : 
                   if need[ data[0].strip() ] not in person or person[ need[ data[0].strip() ] ] == '':
                      person[ need[ text[0].strip() ] ] = text[1].strip() 
  </code></pre>
  
  <p>Second Error</p>
  
  <pre><code>  File "site_scrapers/v12software.scraper.py", line 66, in scrape
      text = [ data.contents[0].get_text(), data.contents[1].get_text() ] 
    File "build/bdist.linux-x86_64/egg/bs4/element.py", line 737, in __getattr__
    AttributeError: 'NavigableString' object has no attribute 'get_text'
  </code></pre>
  
  <p>I tried to get above element string to <strong>person</strong> array.</p>
  
  <p>I need the result to look like this: </p>
  
  <pre><code>  print person['Name']
    #output Piter
    print person['Year']
    #output 2017
  </code></pre>