Skip to content

Instantly share code, notes, and snippets.

@CodyKochmann
Last active August 7, 2016 04:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save CodyKochmann/d2e20a5e04decf6fee16 to your computer and use it in GitHub Desktop.
Save CodyKochmann/d2e20a5e04decf6fee16 to your computer and use it in GitHub Desktop.
splits all strings in a list with the splitter and adds them back (really helpful in certain search algorithms)
def split_all_strings(input_array, splitter):
# splits all strings in a list with the splitter and adds them back
# by: Cody Kochmann
if isinstance(input_array, basestring):
# patch to accept input_array in string form
input_array = [input_array]
result = []
for i in input_array:
for x in i.split(split_char):
result.append(x)
return(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment