[EMAIL PROTECTED] wrote: > Is there a function in Python analogous to the "where" function in > IDL? > > x=[0,1,2,3,4,2,8,9] > print where(x=2) > > output: > [2,5]
If you're doing a lot of this kind of thing, you probably want to use numpy:: >>> import numpy >>> x = numpy.array([0, 1, 2, 3, 4, 2, 8, 9]) >>> numpy.where(x == 2) (array([2, 5]),) You can find numpy here: http://numpy.scipy.org/ STeVe -- http://mail.python.org/mailman/listinfo/python-list