Simple use Python find function or index function to get the index of the character in the string. The difference between the two is what happens when the search string isn’t found.
Example get index of a character in a string python
Simple example code.
s = 'Position of a character' res = s.find('s') print(res)
s = 'Position of a character' res = s.index('s') print(res)
Do comment if you have any doubts and suggestions on this Python index topic.
Note: IDE: PyCharm 2021.1.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.