title: Python: Make HTTP Errors (500) Not Stop Script
body: <p>This is the basic part of my code that I need help with. Note I learned python like last week. I don't understand try and exceptions and I know that what I need for this, so if anyone could help that would be great.</p>
  
  <pre><code>url = 'http://google.com/{0}/{1}'.format(variable, variable1)
  site = urllib.request.urlopen(url)
  </code></pre>
  
  <p>That's not the real website but you get the idea. Now I'm running a <code>loop</code> over 5 times per item, then running around 20 different items. So it goes to say
  <code>google.com/spiders/</code>(runs 5 times with diff types of spiders)
  <code>google.com/dogs/</code>(runs 5 times with diff types of dogs)etc. </p>
  
  <p>Now the 2nd <code>variable</code> is the same on like 90% of the items I'm looping over, but 1 or 2 of them have some of the "types" but not others. So I get an <code>http error 500</code> because that site doesn't exist. How do I make it basically skip that. Its not something else, I know <code>error 500</code> isn't the right error I believe, but I know the pages for those items don't exist. So how do I set this up so that it just skips that one if it gets any error. </p>