捕捉异常(3)
来源:互联网 发布:查看淘宝关键词搜索量 编辑:程序博客网 时间:2024/06/05 06:26
while True: try: x=input('Enter the first number:') y=input('Enter the second number:') value=x/y print 'x/y is ',value except: print "Invalid input.Please try again." else: break
Enter the first number:1
Enter the second number:0
Invalid input.Please try again.
Enter the first number:
Invalid input.Please try again.
Enter the first number:'foo'
Enter the second number:'bar'
Invalid input.Please try again.
Enter the first number:baz
Invalid input.Please try again.
Enter the first number:10
Enter the second number:2
x/y is 5
0 0
- 捕捉异常(3)
- python练习题(3)_捕捉异常
- 捕捉异常(1)
- 捕捉异常(2)
- 异常处理(异常捕捉)
- Filter (3)【日志记录与异常捕捉】
- Python(3):比较、分支判断、循环、异常捕捉
- 异常捕捉
- 异常捕捉
- 捕捉异常
- 异常捕捉
- 捕捉异常
- 异常捕捉
- python捕捉对象(异常处理)
- 波形捕捉:(3)"捕捉设备"性能
- 运行时异常(不需要捕捉)与一般异常有何异同(需要捕捉)
- python异常处理实例教程(捕捉异常、错误)
- 2013年3月算法练习(六) C++抛出和捕捉异常
- php中的parse_url函数学习理解
- java问题日常积累
- 计算机网络基本用语概括
- JS实现漂亮的淡蓝色滑动门效果代码
- Environment类;logcat的作用
- 捕捉异常(3)
- 插播一条关于Socket编程的小程序,
- Java的注解总结
- 爬楼梯
- ubuntu press S to skip
- 【数据结构】中缀表达式的实现
- 问题
- Nginx location指令匹配顺序规则
- TabLayout中tab.setCustomView的操作