异常检测
亲测
def test():
s = '你好'
#print(len(s))
s = [1,2,3]
for i in s:
k = 1
try:
print(i)
print(s[5])
except:
k = 0
if k == 0:
continue
print('00000')
输出:
1
2
3
print('00000')没有输出,证明发生异常后面没有执行,跳出本次循环。
异常检测
亲测
def test():
s = '你好'
#print(len(s))
s = [1,2,3]
for i in s:
k = 1
try:
print(i)
print(s[5])
except:
k = 0
if k == 0:
continue
print('00000')
输出:
1
2
3
print('00000')没有输出,证明发生异常后面没有执行,跳出本次循环。