简单的异常处理 代码 12345678 try: text = input('Enter someting -->')except EOFError: print('Why did you do an EOF on me?')except KeyboardInterrupt: # 按ctrl+C print('You cancelled the operation.')else: print('You enterd {}'.format(text)) 运行结果 12 Enter someting -->^DWhy did you do an EOF on me? 赞微海报分享
近期评论