I'm building off of these two questions because they don't quite answer my question: How to change values in a tuple? Python: Replace "-" with whitespace
If I have a tuple like this:
worldstuff = [('Hi', 'Hello-World', 'Earth'), ('Hello-World', 'Hi'), ...]
How do I replace dashes with whitespaces for all of the elements across all lists in a tuple? The previous Stack Overflow question covers changing the specific index of one list in a tuple, but not if there are multiple occurances of an element needing to be replaced.
I've tried doing the following, which doesn't quite work:
worldstuff_new = [x.replace('-', ' ') for x in worldstuff]
But if I do it for a specific list in the tuple, it works for that tuple list. I'm trying to avoid having to do separate lists and instead trying to do it all at once.
worldstuff_new = [x.replace('-', ' ') for x in worldstuff[0]]
I understand that tuples are immutable, which is why I am having trouble figuring this out. Is this possible? Would appreciate any help - thanks.