Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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