Skip to content

Instantly share code, notes, and snippets.

@messiest
Created June 25, 2018 14:19
Show Gist options
  • Save messiest/b39161deb644e1273f2380a079f25d02 to your computer and use it in GitHub Desktop.
Save messiest/b39161deb644e1273f2380a079f25d02 to your computer and use it in GitHub Desktop.
Return the index of the string that contains the substring
def substring_index(strings, substring):
for i, s in enumerate(strings):
if substring in s:
return i
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment