Advertisement
emailkgnow

Ex

Feb 17th, 2014
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. class ShortInputException(Exception): def __init__(self, length, atleast):
  2.         Exception.__init__(self)
  3.         self.length = length
  4.         self.atleast = atleast
  5. try:
  6. text = input() if len(text) < 3:
  7. raise ShortInputException(len(text), 3) # Other work can continue as usual here
  8. except EOFError:
  9. print()
  10. except ShortInputException as ex:
  11. print(\
  12. .format(ex.length, ex.atleast)) else:
  13. print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement