fork download
  1. from random import choice
  2.  
  3. try:
  4. raise choice([ValueError, IndexError, KeyError])
  5. except Exception as e:
  6. print('shared:', e.__class__.__name__)
  7. try:
  8. raise
  9. except ValueError:
  10. print('value error:', e.__class__.__name__)
  11. except (IndexError, KeyError):
  12. print('index/key error:', e.__class__.__name__)
Success #stdin #stdout 0.04s 9856KB
stdin
Standard input is empty
stdout
shared: KeyError
index/key error: KeyError