I want to create a for loop that will go through integers from 0 to k-1, except for integer i. (I am comparing some lists of k elements, and I do not need to compare the element I in one list with the element I in another list.)
I have a pretty simple way to do this, but I keep thinking of a more “Pythonic”, elegant way to do this.
What am I doing:
tocheck = range(k) del(tocheck[i]) for j in tocheck:
It's easy enough, but one thing I like about Python is that it always seems like there is a smart one-line “Pythonic” trick for such things.
Thanks.
source share