I have a list
with these values ['apple', 'banana', '10', 'oranges']
I want to iterate every element in the list and try to convert it into an int
.
this is my code so far
lst = ['apple', 'banana', '10', 'oranges']
for i in lst:
try:
int_ele = int(i)
print(int_ele)
except:
continue
Now this code works. But when I run pylint
on this code I get this error
W0702: No exception type(s) specified (bare-except)
How should I get rid of this error?