tags:

views:

55

answers:

1

So if my string is "the dude is a cool dude".
I'd like to find the first index of 'dude':

mystring.findfirstindex('dude') # should return 4

What is the python command for this?
Thanks.

+6  A: 

find()

>>> s = "the dude is a cool dude"
>>> s.find('dude')
4
Adam Bernier