# 1.未定义
print(a)

# 2. 类型不一致
b = ‘haha‘
c = 123
b+c

b+str(c)
‘haha123‘
c+b

c+int(b)

int(‘8‘)
8
# 3.语法错误
# 符写错了
print(123)

# 漏符号
if 3>2
print(666)

# 太多符号导致遗漏
int(int(eval(‘123‘))

# 4. 缩进错误 ,出现于 if - 循环 -函数 和 class
if 2>1:
print(2)
print(3)

for i in range(5):
print(i)
print(i+1)

# 5.索引错误
list2 = [1,2,3]
print(list2[3])

# 6. NoteType错误
# 一般发生在我们连写的时候
dict2={‘a‘:‘12345‘,‘B‘:‘45678‘}
dict2.get(‘a‘)[-1]
print(dict2.get(‘b‘)[-1])

dict2={‘a‘:‘12345‘,‘B‘:‘45678‘}
print(dict2.get(‘b‘).find_all(‘img‘))

# 7.文件关闭,继续写入
with open(‘1.txt‘,‘w‘) as f:
f.write(‘123‘)
f.write(‘456‘)

# 8. 权限错误
# csv,excel被 打开的时候,继续写入就会出现
# Permissions error
原文:https://www.cnblogs.com/James-221/p/13770935.html