How to split a list into separate words. I know that you can split strings with split
but I need to split a list.
Here is my code:
text = ['a,b', 'c,d']
text = text.replace(',', ' ')
for i in text:
print(text.split())
When I run it, an error pops up and when I try to convert the list into a string there are random extras like \n, ' and [] that shouldn't be there.
Expected result: I want the outcome to be a list that contains ['a', 'b', 'c', 'd'] that when I print, comes up with that.
The error comes up on line two and says:
AttributeError: 'list' object has no attribute 'replace'