I have a list that looks like so:
['Man City', 'Chelsea', 'Man City', 'Man City', 'Man City', 'Man City', 'Chelsea, Real Madrid, Sevilla', 'West Brom, Sunderland, PSG', 'Man City', 'Man City']
However, I want to change it so the strs with multiple teams become a list within the list
['Man City', 'Chelsea', 'Man City', 'Man City', 'Man City', 'Man City', ['Chelsea', 'Real Madrid', 'Sevilla'], ['West Brom', 'Sunderland', 'PSG'], 'Man City', 'Man City']
'[Chelsea, Real Madrid, Sevilla]', did you mean['Chelsea', 'Real Madrid', 'Sevilla']? Please read How to Ask and think about the logical steps needed to solve the problem. For example, can you write code that tells whether one of the original strings has multiple team names? Can you write code that creates the list for one of those strings? Can you write code that applies this process to each element of the list? If you put those things together, does it not solve the problem?', 'in the string and if present - split at it[str([x]) if ',' in x else x for x in data]