Created
December 1, 2023 10:51
Revisions
-
gboeer created this gist
Dec 1, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ import re def substring_idx(text, substring): """Return the starting indices of all occurrences of substring in text.""" pattern = re.escape(substring) return [match.start() for match in re.finditer(pattern, text)]