I have put multiple strings in a list with the line.split(":")
method and one of them contains a certain character I want to find and return its index in the list.
For example:
s = "Hello StackOverflow!"
lst = s.split(" ") # ["Hello", "StackOverflow!"]
Now I want to get the index of character '!'
, so the desired output should be index 1
, as it's in the second string. I could not make it work with lst.find('!')
, as it works only for characters in list and not strings in lists. Probably you can help find a simple solution.