Python 简单异常处理
2014-10-17 00:00
423 查看
s=raw_input("Input your age:") if s =="": raise Exception("Input must no be empty.") try: i=int(s) except ValueError: print "Could not convert data to an integer." except: print "Unknown exception!" else: # It is useful for code that must be executed if the try clause does not raise an exception print "You are %d" % i," years old" finally: # Clean up action print "Goodbye!" raw_input("press any key to continue...")
相关文章推荐
- [原]Python 简单异常处理
- Python中异常处理简单示例(try,except,finally)
- P-1.8 Python简单异常处理 try... 语句
- python简单执行异常处理
- Python 简单异常处理
- [原]Python 简单异常处理
- 用Python简单处理SQL语句绕过防注入
- python笔记(十) - 异常和文件处理
- 简单的.net 中的异常处理
- python 简单图像处理(9) 灰度变换
- 请描述Java中异常处理机制的简单原理和应用,并说明Error与Exception有什么区别?
- Python异常处理体系简介
- python 简单图像处理(5) 缩放
- python 简单图像处理(11) 空间域图像锐化(边缘检测)
- python 简单图像处理(6) 错切
- python 简单图像处理(7) 计算直方图
- python 简单图像处理(2) 镜像
- 一个简单的页面异常处理
- python字符串处理简单优化
- python 简单图像处理(4) 旋转