64 lines
821 B
Python
64 lines
821 B
Python
|
#语法错误SyntaxError:
|
|||
|
#2_a=2
|
|||
|
|
|||
|
#SyntaxError: invalid decimal literal
|
|||
|
|
|||
|
|
|||
|
#list=[2,3,4,5,6,7,8]
|
|||
|
#for i in list:
|
|||
|
#list.append(12)
|
|||
|
|
|||
|
#SyntaxError: invalid character ':' (U+FF1A)
|
|||
|
|
|||
|
|
|||
|
#for i in range
|
|||
|
#a=1
|
|||
|
|
|||
|
#SyntaxError: expected ':'
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#类型错误TypeError:
|
|||
|
#a=1
|
|||
|
#b='1'
|
|||
|
#print(a+b)
|
|||
|
|
|||
|
#TypeError: unsupported operand type(s) for +: 'int' and 'str'
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#名称错误NameError:
|
|||
|
#r
|
|||
|
|
|||
|
#NameError: name 'r' is not defined
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#分数为零ZeroDivisionError:
|
|||
|
#n=1
|
|||
|
#print(n/0)
|
|||
|
|
|||
|
#ZeroDivisionError: division by zero
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#值异常ValueError:
|
|||
|
#a=int("1.4")
|
|||
|
|
|||
|
#ValueError: invalid literal for int() with base 10: '1.4'
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#属性异常AttributeError:
|
|||
|
#import math
|
|||
|
#math.goto
|
|||
|
|
|||
|
#AttributeError: module 'math' has no attribute 'goto'
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#下标越界异常IndexError:
|
|||
|
#list=[1,2,3,4,5,6]
|
|||
|
#list[6]
|
|||
|
|
|||
|
#IndexError: list index out of range
|