异常处理链接
目录
io.UnsupportedOperation(IO文件操作错误):
json.decoder.JSONDecodeError(JSON 解码错误):
IndentationError(缩进错误):
expected an indented block :应为缩进块
unindent does not match any outer indentation level : 未缩进不匹配任何外部缩进级别
SyntaxError(语法错误):
invalid syntax :无效语法
TypeError:(类型错误)
'*' object does not support item assignment :某对象不支持项分配
an integer is required (got type str) : 参数没有指定位置,应该是关键字参数
can't send non-None value to a just-started generator : 无法将非无值发送到刚启动的生成器
'in <string>' requires string as left operand, not function :“in<string>”需要字符串作为左操作数,而不是函数
NameError(命名错误):
name '变量名' is not defined : 某变量名没有被发现(也就是没有定义该变量名)
ZeroDivisionError(零分割错误):
division by zero :除数为零错误
LookupError(查找者):
unknown encoding: unicode : 编码未知错误
IndexError(索引错误):
* assignment index out of range :* 分配索引超出范围
ValueError(值误差):
invalid literal for int() with base 10: 变量值 : 变量值无效
too many values to unpack (expected 2) : 要解包的值太多,应该为 2
not enough values to unpack (expected 2, got 1) :值不足,无法解包,应该为 2 ,实际只给了 1
AttributeError(属性错误):
'**' object has no attribute * : * 对象中没有 ** 属性
io.UnsupportedOperation(IO文件操作错误):
not writable : 文件不存在或者文件提前关闭。
not readable : 不可读
RuntimeError(运行时错误):
dictionary changed size during iteration :字典在迭代期间更改了大小
StopIteration (迭代停止)
ImportError(导入错误):
cannot import name 'x' : 无法导入名称 ‘X’
RecursionError: (递归错误)
maximum recursion depth exceeded : 超过递归的最大深度
OSError(操作系统错误):
[Errno 22] Invalid argument : 参数无效
json.decoder.JSONDecodeError(JSON 解码错误):
Expecting property name enclosed in double quotes: line 1 column 2 (char 1) :预期用双引号括起来的属性名称: 第1行第2列 (char 1)
(原因是JSON内容有用utf-8存储的)
UnboundLocalError(未绑定的本地错误):
local variable 'LOGGIN' referenced before assignment : 在赋值之前引用的局部变量“LOGGIN”