Tup = ('string1','string2','string3')
My program returned string2 how do I get it's index within Tup?
Tup = ('string1','string2','string3')
My program returned string2 how do I get it's index within Tup?
>>> tup.index('string2')
1
Note that the index()
method has only just been added for tuples in versions 2.6 and better.