Python is so predictable:
>>> string = 'This + is + a + string'
>>> string.find('+',7)
10
Checkout help(str.find):
find(...)
S.find(sub[, start[, end]]) -> int
Return the lowest index in S where substring sub is found,
such that sub is contained within S[start:end]. Optional
arguments start and end are interpreted as in slice notation.
Return -1 on failure.
Also works with str.indexaccept what it will be raise ValueErrorwhen a substring is not found instead -1.
source
share