Is there any way to find out what nth, a specific character is on a string?

Question:

For example, finding nth the a in the string abcdefg.

Asked By: iGamer 236

||

Answers:

I think find() is what you are looking for.

example = "abcdefg"
print(example.find("a"))

This should return 0.

Answered By: TheMoonandSixpence
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.