import time try: for n in range(5): print(n) time.sleep(1) except KeyboardInterrupt: print("割り込まれました!") print("終了〜") # プログラム10-2(キーボード割り込みの処理)