title: Python - TypeError: object of type 'NoneType' has no len()
body: <p>I wrote a code that strips two values from a set of 50 items from a website and stored them into a list. However, when I check to see how many values there are via <code>len()</code> I get the following error:</p>
  
  <pre><code>TypeError: object of type 'NoneType' has no len()
  </code></pre>
  
  <p>This is my code:</p>
  
  <pre><code>from datetime import datetime
  
  response = links
  
  def get_links(response):
      list_links = []
      for i in range(len(response)):
          url = response[i].select('a')[0]['href']
          date = datetime.strptime(response[i].select('span.field-content')[1].text, '%A, %B %d, %Y')
          list_links.append((url, date))
  
  get_links(response)
  
  page = get_links(response)
  
  assert len(page) == 50
  </code></pre>
  
  <p>any ideas?</p>