try:
1/0
print(1)
except ZeroDivisionError:
pass
as above, I want print (1) to continue to run after ZeroDivisionError is triggered.
it"s not realistic to write two try. What if I have 100 print behind me? It"s stupid to write 100 try.
means that there are several statements that are independent of each other, and they may trigger, for example, a ZeroDivisionError exception, so I don"t want the statement after the exception statement to stop running, but continue to run.
try:
1/0
print(1)
1/0
print(1)
1/0
print(1)
1/0
print(1)
1/0
print(1)
1/0
print(1)
1/0
print(1)
1/0
print(1)
1/0
print(1)
1/0
print(1)
1/0
print(1)
1/0
print(1)
except ZeroDivisionError:
pass
for example, in the above paragraph, I want him to ignore all 1A zeros and print out all print (1)
.how is it that when multiple lines of code are running, each line has different functions, but is independent of each other and not related to each other, and one of them is abnormal, ignoring the exception, and then the lines that are not running continue to run?
what cycle? exec,eval is written in stupid way. Is there any ingenious way to realize it? thank you
.