[Solved] How to check if a particular string is present in a List of strings , but also its Index


If all you want to do is return the index of b inside of a, if b is present, and so something else if it is not, try this : –

a = ["one", "two", "three", "four"]
b = "three"
try:
    print a.index(b) #if inside the function, use return
except:
    #do something2

solved How to check if a particular string is present in a List of strings , but also its Index