title: How to get around 'NoneType' object has no attribute 'text'
body: <p>I'm working on an eBay Scraper, and I'm having some trouble with a simple &quot;AttributeError: 'NoneType' object has no attribute 'text'&quot;...</p>
  <p>Here is my code</p>
  <pre><code>url = 'https://www.ebay.com/sch/i.html?_from=R40&amp;_nkw=2017+patrick+mahomes+psa+10+auto&amp;_sacat=0&amp;rt=nc&amp;LH_Sold=1&amp;LH_Complete=1&amp;_ipg=100'
  
  def get_data(url):
      r = requests.get(url)
      soup = bs(r.text, 'html.parser')
      return soup
  
  def parse(soup):
      productslist = []
      results = soup.find_all('div', {'class': 's-item__info clearfix'})
      for item in results:
          product = {
              'title': item.find('h3', class_='s-item__title s-item__title--has-tags').text,
              'soldprice': float(item.find('span', class_='s-item__price').text.replace('$', '').replace(',','').strip()),
              'solddate': item.find('span', class_='s-item__title--tagblock__COMPLETED').find('span', class_='POSITIVE').text,
              'bids': item.find('span', class_='s-item__bids s-item__bidCount').text,
              'link': item.find('a', class_='s-item__link')['href'],
              }
          productslist.append(product)
      return productslist
  
  def output(productslist):
      productsdf = pd.DataFrame(productslist)
      productsdf.to_csv('2017_Patrick_Mahomes_Rookies.csv', index=False)
      print('Saved to CSV')
      return
  
  soup = get_data(url)
  productslist = parse(soup)
  output(productslist)
  print(parse(soup))
  </code></pre>
  <p>I'm having trouble with the line.</p>
  <pre><code>'bids': item.find('span', class_='s-item__bids s-item__bidCount').text,
  </code></pre>
  <p>It is returning this error.</p>
  <pre><code>---------------------------------------------------------------------------
  AttributeError                            Traceback (most recent call last)
  &lt;ipython-input-48-0c9ceb760d75&gt; in &lt;module&gt;
       27 
       28 soup = get_data(url)
  ---&gt; 29 productslist = parse(soup)
       30 output(productslist)
       31 print(parse(soup))
  
  &lt;ipython-input-48-0c9ceb760d75&gt; in parse(soup)
       14             'soldprice': float(item.find('span', class_='s-item__price').text.replace('$', '').replace(',','').strip()),
       15             'solddate': item.find('span', class_='s-item__title--tagblock__COMPLETED').find('span', class_='POSITIVE').text,
  ---&gt; 16             'bids': item.find('span', class_='s-item__bids s-item__bidCount').text,
       17             'link': item.find('a', class_='s-item__link')['href'],
       18             }
  
  AttributeError: 'NoneType' object has no attribute 'text'
  
  </code></pre>
  <p>When I remove <code>.text,</code> the code works and I get a csv file like this.</p>
  <p><a href="https://i.stack.imgur.com/OfF82.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OfF82.jpg" alt="enter image description here" /></a></p>
  <p>I want to keep all fields in the vertical &quot;bids&quot; column, strip away the span class html in most fields, and fill in the blank fields with &quot;N/A&quot;. When I run 'try and except' statements, it deletes all the fields without &quot;bids&quot; (e.g. it keeps only fields with '5 bids and '89 bids', and deletes all others).</p>
  <p>Still a beginner, so I apologize for the poor explanation.</p>