try:    val = int(userInput) except ValueError:    print("That's not an int!")

Read more of this post