Hi, there's a list with tuples.
lst = [('Meat', 'Milk'), ('Cake - Cookie',), ('Apple', 'Orange')]
For each tuple of len == 1
I want to split it at -
so it results with:
lst = [('Meat', 'Milk'), ('Cake', 'Cookie'), ('Apple', 'Orange')]
I tried
[tuple(x.split(' - ') for x in tup) for tup in lst if len(tup) == 1]
It splits it up but the other tuples (of len == 2
) are missing. Any suggestions please?