We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ed4cc6f commit e3c43bbCopy full SHA for e3c43bb
Doc/library/stdtypes.rst
@@ -1970,7 +1970,18 @@ expression support in the :mod:`re` module).
1970
.. method:: str.index(sub[, start[, end]])
1971
1972
Like :meth:`~str.find`, but raise :exc:`ValueError` when the substring is
1973
- not found.
+ not found. For example:
1974
+
1975
+ .. doctest::
1976
1977
+ >>> 'spam, spam, spam'.index('eggs')
1978
+ Traceback (most recent call last):
1979
+ File "<python-input-0>", line 1, in <module>
1980
+ 'spam, spam, spam'.index('eggs')
1981
+ ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
1982
+ ValueError: substring not found
1983
1984
+ See also :meth:`rindex`.
1985
1986
1987
.. method:: str.isalnum()
0 commit comments