I have a list below. I want to split like:
['Animation','Children's','Comedy','Adventure',"Children's",'Fantasy','Comedy','Romance','Comedy','Drama']
clist = ["Animation|Children's|Comedy",
"Adventure|Children's|Fantasy",
'Comedy|Romance',
'Comedy|Drama']
for i,x in enumerate(clist):
if '|' in x:
clist[i] = x[:x.index('|')]
it return this:
['Animation', 'Adventure', 'Comedy', 'Comedy']