This returns the index of the ending character of the input pattern.
# Return index of last character of small_string
def end_index(big_string,small_string):
assert small_string in big_string
start_index=big_string.index(small_string)
return start_index + len(small_string)
No comments:
Post a Comment