Skip to content

Instantly share code, notes, and snippets.

@colinpollock
Created December 12, 2019 00:56
Show Gist options
  • Save colinpollock/77efd3613eada997e28feb37ea696f6f to your computer and use it in GitHub Desktop.
Save colinpollock/77efd3613eada997e28feb37ea696f6f to your computer and use it in GitHub Desktop.
sentence = 'Reggie Miller grew up in Riverside before going to UCLA.'
phrase = 'Riverside'
start_index = sentence.find(phrase)
end_index = start_index + len(phrase)
sentence[start_index-10:end_index+10]
# 'rew up in Riverside before go'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment