摘要: # def deco(obj): # print(" ",obj) # obj.x=1 # return obj # @deco# > test = deco(test) >return func # def test(): # print("test函数运行") # # test() def deco(obj): print(" ",obj) obj.x=1 obj.y=2 return obj 阅读全文
posted @ 2019-09-05 11:12 coldplaycode 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 常用异常 AttributeError 试图访问一个对象没有的树形,比如foo.x,但是foo没有属性x IOError 输入/输出异常;基本上是无法打开文件 ImportError 无法引入模块或包;基本上是路径问题或名称错误 IndentationError 语法错误(的子类) ;代码没有正确对齐 IndexError 下标索引超出序列边界,比如当x只有三个元素,却试图访问x[5] KeyEr 阅读全文
posted @ 2019-09-05 09:29 coldplaycode 阅读(207) 评论(0) 推荐(0) 编辑

coldplaycode