except as a control flow mechanism
来源:互联网 发布:淘宝1号店网址 编辑:程序博客网 时间:2024/05/20 12:23
#quote from MIT 'introduction to computation and programming using python, Revised' def getGrades(fname): try: gradesFile = open(fname, 'r') #open file for reading except: raise ValueError('getGrades could not open ' + fname) grades = [] for line in gradesFile: try: grades.append(float(line)) except: raise ValueError('Unable to convert line to float') return grades try: grades = getGrades('quiz.txt') grades.sort() median = grades[len(grades)//2] print 'Median grade is', medianexcept ValueError, errorMsg: print 'Whoops.', errorMsg
0 0
- except as a control flow mechanism
- exception as a control flow mechanism
- exception as a control flow mechanism
- 10A event mechanism
- Minidriver Flow of Control
- Item 47. Control Flow
- Exceptions and control flow
- Program flow control (Notes)
- Control Flow Functions!
- Producer Flow Control
- LSL-- Flow Control
- Flow control in ksh
- Control Flow in Node
- Reliability and Flow Control
- Chapter 4 - Flow Control
- Python en:Control Flow
- Conditionls&Control Flow
- More on Control Flow
- Invert Binary Tree
- 软件开发过程学习笔记(一)之软件开发流程
- STL - deque(双端队列)
- iOS 开发 admob 使用报错
- mysql中统计精度问题
- except as a control flow mechanism
- mysql概念解释
- 台大机器学习基石笔记(一)——机器学习可行性
- 细说Angular ng-class
- A/B(扩展欧几里得算法)
- Android 之一个简单计算器源代码
- 浅析 Ant 脚本部署 RCP 项目
- 取出动态Map中的key值放入List
- firebug操作介绍