title: AttributeError: 'NoneType' object has no attribute 'string
body: <p>I have a list of URL's where I'm scraping title name of each page by looping the entire list of URLs</p>
  
  <p>The problem is whenever the url is invalid in the list the code is breaking up. so I'm trying to use <strong>try</strong> and <strong>except</strong> to pass the error how ever try and except is not working </p>
  
  <p>Below is the code i'm using,(Please correct if I'm missing something here)</p>
  
  <pre><code>    import requests
      from bs4 import BeautifulSoup as BS
      url_list = ['http://www.aurecongroup.com',
      'http://www.bendigoadelaide.com.au',
      'http://www.burrell.com.au',
      'http://www.dsdbi.vic.gov.au',
      'http://www.energyaustralia.com.au',
      'http://www.executiveboard.com',
      'http://www.mallesons.com',
      'https://www.minterellison.com',
      'http://www.mta.org.nz',
      'http://www.services.nsw.gov.au']
  
  for link in url_list:
      try:
          r = requests.get(link)    
          r.encoding = 'utf-8'
          html_content = r.text
          soup = BS(html_content, 'lxml')
          df = soup.title.string
          print(df)
  
      except IOError:
          pass
  </code></pre>
  
  <p>Executing the above code is giving me <code>AttributeError: 'NoneType' object has no attribute 'string'</code>. 
  Can someone help me with this?</p>