3 ms·
There is even a built-in for that: >>> "foo".find("a") -1
by ge0rg 15y ago
There is even a built-in for that:
>>> "foo".find("a")
-1
- andreasvc 15y agoNo there isn't. The one you cite is for strings, not lists. I've always wondered why lists shouldn't also have find, rindex or replace methods.