title: Python : Another 'NoneType' object has no attribute error
body: <p>For a newbie exercise , I am trying to find the meta tag in a html file and extract the generator so I did like this :</p>
  
  <pre><code>Version = soup.find("meta", {"name":"generator"})['content']
  </code></pre>
  
  <p>and since I had this error : </p>
  
  <pre><code>TypeError: 'NoneType' object has no attribute '__getitem__'
  </code></pre>
  
  <p>I was thinking that working with exception would correct it, so I wrote : </p>
  
  <pre><code>try: Version = soup.find("meta", {"name":"generator"})['content']
  
  except NameError,TypeError:
  
       print "Not found"
  </code></pre>
  
  <p>and what I got is the same error. </p>
  
  <p>What should I do then ? </p>