New to python and looking for help.
output = []
mylist = ['LionRed 1','TigerWhite 2','BearBlue 3']
for item in mylist:
tempitem = item.split("Red")[0]
output.append(tempitem)
The output of this is ['Lion', 'TigerWhite 2', 'BearBlue 3']
which is what I want BUT I'd like to add two more splits - "White"
and "Blue"
to get the output ['Lion', 'Tiger', 'Bear']
.