| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2045,7 +2045,18 @@ expression support in the :mod:`re` module). | |||
| 2045 | 2045 | .. method:: str.index(sub[, start[, end]]) | |
| 2046 | 2046 | ||
| 2047 | 2047 | Like :meth:`~str.find`, but raise :exc:`ValueError` when the substring is | |
| 2048 | - not found. | ||
| 2048 | + not found. For example: | ||
| 2049 | + | ||
| 2050 | + .. doctest:: | ||
| 2051 | + | ||
| 2052 | + >>> 'spam, spam, spam'.index('eggs') | ||
| 2053 | + Traceback (most recent call last): | ||
| 2054 | + File "<python-input-0>", line 1, in <module> | ||
| 2055 | + 'spam, spam, spam'.index('eggs') | ||
| 2056 | + ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^ | ||
| 2057 | + ValueError: substring not found | ||
| 2058 | + | ||
| 2059 | + See also :meth:`rindex`. | ||
| 2049 | 2060 | ||
| 2050 | 2061 | ||
| 2051 | 2062 | .. method:: str.isalnum() | |
| Back | FazBrowse Home | New Git URL |
0 commit comments