1.SyntaxError : 'return' out side function
语法错误 : return 不能在方法以外使用
解决办法 : 将 return 放在方法体中使用
2.TypeError : must be str ,not int
类型错误 : 必须是str , 而不是int
解决办法 : 使用+拼接的时候,必须使用字符串或将数字转化为字符串
3.SyntaxError : invalid syntax
语法错误 : 非法的
解决办法 : 看报错信息在第几行,从这一行往上找错误
4.IndentationError : unident does not match any outer indentation level
缩进错误 : 未知缩进与任何缩进级别不匹配
解决办法 : Tab自动缩进
5.IndexError : string index out of range
索引错误 : 字符串索引超出了范围
解决办法 : 查看字符串的长度,索引要小于长度
6.IndexError : list index out of range
索引错误 : 列表索引超出了范围
解决办法 : 索引要小于长度
7.AttributeError : 'tuple' object has no attribute 'remove'
属性错误 : 元组对象没有属性'remove'
8.ValuError : subdtring not found
值错误 : 子字符串未找到
|