Python3:异常处理,try...except
来源:互联网 发布:软件项目风险管理计划 编辑:程序博客网 时间:2024/06/07 17:23
语法规则:
try:
<...............> #可能得到异常的语句except <.......>: #锁定是哪种异常
<...............> #出现异常的处理方法
import systry: s = input('Enter something --> ') #可能得到异常的语句except EOFError: #锁定是哪种异常 print ('ERROR INPUT !') #出现异常的处理方法 sys.exit()print (s)
显然这个程序的意思非常明了,如果输入没有错,那么应该输出输入的字符串. 如果有错,就应该提示.
0 0
- Python3:异常处理,try...except
- try,except异常处理
- Python 异常处理 try/except
- python异常处理try...except
- 异常处理try...except、raise
- Python 异常处理 Python 基础教程 try..except
- (Python)异常处理try...except、raise
- (Python)异常处理try...except、raise
- python中的异常处理 try..except
- Python异常处理try...except、raise
- Python---异常处理try...except、raise
- (Python)异常处理try...except、raise
- Python异常处理try...except、raise
- python try...except....else...finally处理异常
- Python 异常处理 (try 和 except)
- Python 异常 try except
- Python中异常处理简单示例(try,except,finally)
- python中的异常处理:try...except...else...finally语句
- Got error: 1556: You can't use locks with log tables
- share_ptr的线程安全读写方式
- <css 十三> 关于选择器selector(2)
- C++文本文件的IO
- mysql Access denied for user 'root'@'localhost' (using password: NO)解决办法
- Python3:异常处理,try...except
- Java 自增陷阱
- Android 应用接入广点通统计API 方案
- 算法学习(三)字符串查找,删除,复制strstr/strcpy/strpbrk等库函数
- 消息中间件与JMS
- Oral Presentations: Tips on How to Deliver a Speech for School or Work
- -[UIWindow endDisablingInterfaceAutorotationAnimated:]
- 模板类和友元函数再探
- [LeetCode]Longest Increasing Subsequence