title: Try, except in python
body: <p>I am trying to write a simple program that read only two symbols (=, +). I have done the checks using if block like above:</p>
  
  <pre><code>x = raw_input("Please answer + or =")
  if x == '+':
     print "plus" 
  elif x == '=':
     print "equal"
  else:
     print "not valid"
  </code></pre>
  
  <p>I want to remove the else and do the check with try, except. 
  for example I want something like:</p>
  
  <pre><code>try:
     x = raw_input("Please answer + or =")
     if x == '+':
        print "plus" 
     elif x == '=':
        print "equal"
  except ....:
     print "not valid"
  </code></pre>
  
  <p>Does anyone can help me? 
  Thank you</p>