Python 异常 try except
来源:互联网 发布:java emptylist 编辑:程序博客网 时间:2024/06/02 09:01
try: file =open(r"C:\Users\1.txt","rb") mystr=file.readline().decode("utf-8") mylist=mystr.split(" # ") num=eval(mylist[0]) #转化失败 print(mystr) print(num) file.write("12321")except FileNotFoundError: print("文件没有找到")except NameError: #特定的异常 print("转换失败")except:#除了上述之外的所有异常。 print("处理其他所有异常")else:#没有异常的情况 print("没有异常执行这里")finally:#有没有异常,无论如何都执行 print("有没有异常执行这一句") file.close()
阅读全文
0 0
- Python 异常 try except
- python 异常 try-except句型
- Python 异常处理 try/except
- python 异常 try-except句型
- python异常处理try...except
- Python 异常处理 Python 基础教程 try..except
- (Python)异常处理try...except、raise
- Python文件异常try/except/finally
- (Python)异常处理try...except、raise
- python中的异常处理 try..except
- Python异常处理try...except、raise
- python try except 捕获所有异常
- Python---异常处理try...except、raise
- (Python)异常处理try...except、raise
- Python异常处理try...except、raise
- python try...except....else...finally处理异常
- Python 异常处理 (try 和 except)
- try,except异常处理
- hql语句中使用占位符:xx 的时候,查询所有查询查不出来
- go json
- eclispe中 jar包添加到lib目录下和 build path 的区别
- java如何给main方法传递实参
- github从远程库获取修改后提交
- Python 异常 try except
- 无线路由器桥接
- java 中什么是aop
- Linux中gpasswd命令的使用方法
- GOF23种设计模式
- 大学生职业生涯规划
- Launcher3的启动流程(一)
- Github上如何查看当前最流行的开源项目
- 发现eclipse红叉,查看problem发现Target runtime Apache Tomcat 7.0 is not defined