title: running code if try statements were successful in python
body: <p>I was wondering if in python there was a simple way to run code if a try statement was successful that wasn't in the try statement itself. Is that what the else or finally commands do (I didn't understand their documentation)? I know I could use code like this:</p>
  
  <pre><code>successful = False
  try:
      #code that might fail
      successful = True
  except:
      #error handling if code failed
  if successful:
      #code to run if try was successful that isn't part of try
  </code></pre>
  
  <p>but I was wondering if there was a shorter way.</p>