How to get the index of a character in Python String
To get the index of a character in a python string, we can use the built-in find()
method.
Here is an example that gets the n
character index in the following string.
myString = 'King'
index = myString.find('n')
print(index) # 2