[Tutor] position of an element in list:

Luke Paireepinart rabidpoobear at gmail.com
Fri Jul 23 15:29:12 CEST 2010


You can do it with any iterator.... Astr.index('o') I'm not sure what happens when there are multiple instances of 'o' though, check the docs on index.

Sent from my iPhone

On Jul 23, 2010, at 8:22 AM, Vineeth Rakesh <vineethrakesh at gmail.com> wrote:

> Hello all, 
> 
> How to return the position of a character in a string. Say I have str1 = "welcome to the world" if i want to return the position of the first occurrence of "o" how to do it?
> 
> Thanks
> Vin 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor


More information about the Tutor mailing list