import sys try: while(True): try: x = raw_input('>>') print (x + '2') except EOFError: break except KeyboardInterrupt: sys.exit(1) ~