try: x = raw_input("Enter an integer: ") y = int(x) print "Your number was", yexcept (TypeError, ValueError): print "That didn't look like an integer to me."