Let say I have a for loop like this
data = [1, 2, 3, '4', 5]
for d in data:
print(d * 0)
Output
TypeError: can only concatenate str (not "int") to str
Then if I use Try:
except
blocks
data = [1, 2, 3, '4', 5]
try:
for d in data:
print(d * 0)
except TypeError:
pass
Output
1
2
3
I wonder, is it possible to get the skipped value
In this case '4'
Or in other words, is it possible to get the value that caused the exception?
My question is not related to just this piece of code but Python overall.