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

Time:10-09

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

CodePudding user response:

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

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

This should return 0.

  • Related