"7stud" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | How about: | | l = [1, 2, 1, 3, 1, 5] | target = 1 | for index, val in enumerate(l): | if val==1: | lastIndexOf = index | | print lastIndexOf
You might want to initialize lastIndexOf (to None, for instance). If len(l) = 1000000, you might prefer to start from the end, as I suggested. tjr -- http://mail.python.org/mailman/listinfo/python-list