I’ve got this python dictionary ‘mydict’, containing arrays, here’s what it looks like :
mydict = dict( one=['foo', 'bar', 'foobar', 'barfoo', 'example'], two=['bar', 'example', 'foobar'], three=['foo', 'example'])
i’d like to replace all the occurrences of ‘example’ by ‘someotherword’.
While I can already think of a few ways to do it, is there a most ‘pythonic’ method to achieve this ?
1 Answer