I want to use just one try\except
for many variables. I want to find out which part is causing the error so I could print it to the user under the except
part.
try:
i = int(i)
j = int(j)
k = int(k)
l = int(l)
m = int(m)
n = int(n)
n+1 = int(n+1)
...
..
.
except ValueError:
print('Please enter an integer as {}'.format(# whether i, j, k, l, or ...))
I want to find out which int(x)
is causing the error so I can print it to the user? Is there any way to do it? I don't want to try for each part because my variables are nearly infinite ;)