[Tutor] how to find index of list with its value

Joel Goldstick joel.goldstick at gmail.com
Thu Dec 8 16:33:43 CET 2011


On Thu, Dec 8, 2011 at 10:28 AM, surya k <suryak at live.com> wrote:

>
> Well, we all know to know the value when we have the index of a list. But
> how can we find it in the reverse way...
> say a listl=[1,2,3,4]
> l[0]=1.but how can I find its address with its value 1 ??
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>

l.index(1)

This will find the index of the first element with the value of 1

-- 
Joel Goldstick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111208/c79f23d3/attachment.html>


More information about the Tutor mailing list