打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
python 笔记

1.python类中不支持函数重载

2.子类总是覆盖父类的方法,甚者参数列表不同也能覆盖

3.捕捉文件IO异常
try:
fsock = open("/notthere")
except IOError:
print "The file does not exist,exiting gracefully"
print "The line will always print"

4.常见异常
#no dictionray key:    KeyError

#no list value:             ValueError

#no function:              AttributeError

#no variable:             NameError

#no tran data type:  TypeError 

#no module:             ImportError

5.尝试某种操作,操作某个变量,方法,或导入模块
try:
print tanxiaohai
except NameError:
print "the value does not exist"
else:
print "the value exist"
print "always printf"
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Python 捕获错误和异常的多种类型
写程序时总会碰到异常的!超级详细的python异常处理教程送给你!
Python3 错误和异常 | 菜鸟教程
Python进阶08 异常处理
【Python3之异常处理】
python中常见错误整理
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服