摘要: 判断输入是否为数字 续这里用到了检测与处理异常的try-except语句。下面是一个例子,在Python交互环境执行的: a = int(raw_input('Please input an integer ... '))Please input an int number ... tTraceback (most recent call last): File "stdin", line 1, in moduleValueError: invalid literal for int() with base 10: 't'那么,如果使用了try-except语句,结果就是这样的。 阅读全文
posted @ 2011-01-20 21:06 balian 阅读(1491) 评论(0) 推荐(0) 编辑