How to detect if a Python string contains a substring?
Similar to the find () method, the index () method can also be used to retrieve whether the specified string
is included. The difference is that when the specified string does not exist, the index() method
will throw an exception.
The syntax of the index() method is as follows:
The meaning of each parameter in this format is:
str: the original string;
sub: the substring to be retrieved;
start: indicates the starting position of the search. If not specified, the search
starts from the beginning by default;
end: indicates the end position of the search. If not specified, the search
will continue until the end by default.
[Example] Use index () method to retrieve the index of the first occurrence of "e" in