print(a)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-1-70ed2873a890> in <module>
1 # 1.未定义
----> 2 print(a)
NameError: name 'a' is not defined
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
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'
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'
print(123)
File "<ipython-input-6-94af2698dffa>", line 2
print(123)
^
SyntaxError: invalid character in identifier
if 3>2
print(666)
File "<ipython-input-7-75cad109330d>", line 2
if 3>2
^
SyntaxError: invalid syntax
int(int(eval('123'))
File "<ipython-input-8-11fff21863fc>", line 2
int(int(eval('123'))
^
SyntaxError: unexpected EOF while parsing
if 2>1:
print(2)
print(3)
File "<ipython-input-9-43763d7ec7c2>", line 4
print(3)
^
IndentationError: unexpected indent
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
dict2 = {'a':'12345','B':'45678'}
dict2.get('a')[-1]
dict2.get('b')[-1]
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-12-d6fb3babac46> in <module>
2 dict2 = {'a':'12345','B':'45678'}
3 dict2.get('a')[-1]
----> 4 dict2.get('b')[-1]
TypeError: 'NoneType' object is not subscriptable
dict2 = {'a':'12345','B':'45678'}
print(dict2.get('b').find_all('img'))
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-13-2df3f5fc235b> in <module>
1 dict2 = {'a':'12345','B':'45678'}
----> 2 print(dict2.get('b').find_all('img'))
AttributeError: 'NoneType' object has no attribute 'find_all'
转载请注明原文地址:https://blackberry.8miu.com/read-17452.html