Last active
August 7, 2016 04:46
-
-
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)
This file contains 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 characters
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