exceptions_handle.py 220 B

123456789
  1. try:
  2. text = input('Enter something --> ')
  3. except EOFError:
  4. print('Why did you do an EOF on me?')
  5. except KeyboardInterrupt:
  6. print('You cancelled the operation.')
  7. else:
  8. print('You entered {}'.format(text))