title: Python. AttributeError: 'NoneType' object has no attribute 'startswith'
body: <p>Why is it this code won't work and give AttributeError?</p>
  
  <pre><code>internship = parser.find_all('a', attrs = {'title': lambda job: job.startswith('Internship')})
  </code></pre>
  
  <p>while this one works:</p>
  
  <pre><code>internship = parser.find_all('a', attrs = {'title': lambda job: job and job.startswith('Internship')})
  </code></pre>
  
  <p>This is the error that I got from the first code:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "C:\Python27\lib\site-packages\bs4\element.py", line 1299, in find_all
     return self._find_all(name, attrs, text, limit, generator, **kwargs)
    File "C:\Python27\lib\site-packages\bs4\element.py", line 549, in _find_all
     found = strainer.search(i)
    File "C:\Python27\lib\site-packages\bs4\element.py", line 1690, in search
     found = self.search_tag(markup)
    File "C:\Python27\lib\site-packages\bs4\element.py", line 1662, in search_tag
      if not self._matches(attr_value, match_against):
    File "C:\Python27\lib\site-packages\bs4\element.py", line 1722, in _matches
      return match_against(markup)
    File "&lt;stdin&gt;", line 1, in &lt;lambda&gt;
  AttributeError: 'NoneType' object has no attribute 'startswith'
  </code></pre>