# 1.未定义:NameError: name 'a' is not definedprint(a)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-70ed2873a890> in <module>
1 # 1.未定义
----> 2 print(a)
NameError: name 'a' is not defined
# 2.类型不一致:TypeError: must(必须) be(是) str, not(不) int
b ='name'
c =123
b+c
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-2-1b1b33123c88> in <module>
2 b = 'name'
3 c = 123
----> 4 b+c
TypeError: must be str, not int
# TypeError: unsupported operand type(s) for +: 'int' and 'str'
c+b
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-baf87dc38fa6> in <module>
----> 1 c+b
TypeError: unsupported operand type(s) for +: 'int' and 'str'
# ValueError: invalid literal for int() with base 10: 'name'
c+int(b)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-4-362903aa1601> in <module>
----> 1 c+int(b)
ValueError: invalid literal for int() with base 10: 'name'
File "<ipython-input-9-43763d7ec7c2>", line 4
print(3)
^
IndentationError: unexpected indent
# 5.索引错误:IndexError: list index out of range(范围)list=[1,2,3]print(list[3])
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-10-16cd916f6e29> in <module>
1 # 5.索引错误
2 list = [1,2,3]
----> 3 print(list[3])
IndexError: list index out of range