PRG-PY_try_except
Python3 の エラーハンドリング
https://docs.python.org/ja/3/tutorial/errors.html
>>> while True: ... try: ... x = int(input("Please enter a number: ")) ... break ... except ValueError: ... print("Oops! That was no valid number. Try again...") ...