Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ShortInputException(Exception): def __init__(self, length, atleast):
- Exception.__init__(self)
- self.length = length
- self.atleast = atleast
- try:
- text = input() if len(text) < 3:
- raise ShortInputException(len(text), 3) # Other work can continue as usual here
- except EOFError:
- print()
- except ShortInputException as ex:
- print(\
- .format(ex.length, ex.atleast)) else:
- print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement