Use of index

SUBHABRATA subhabrata.iisc at hotmail.com
Sat Jul 12 06:16:22 EDT 2008


Dear All,
I have a small question.
If I have code line like the following:

a1="God"
a2="God is always great"
a3=a2.index(a1)
a4=a2.find(a1)
a5=a2.split()
a6=a5.index(a1)
a7=a5.find(a1) # Invalid as find is applicable only in string but not
in list.
if a4>-1:
    print "God may be always great"

--------------------------------------------------------------
Now, my q is can we use index like find?

Regards,
Subhabrata.



More information about the Python-list mailing list