Im trying to loop through a list in python and split words based on characters. I want to return a 1 dimension list as the result.
Example
wordlist = ['border\collie', 'dog\cat', 'horse\hound'] # slash fix
Expected outcome new_list = ['border', 'collie', 'dog', 'cat', 'horse', 'hound']
Everything that Ive tried results in a 2d list.
def split_slash_words(text):
new_list = []
new_list.append([i.split("\\") for i in text])
return new_list
returned a two dimensional array, and I cannot also resplit the new_list (as it is in a list type)