python dictionary change value along the way

Hello, tell me how it is most beautiful to change the value in the dictionary along the way. The dictionary can contain as dictionaries and lists inside.
For example, the dictionary:
{ "test1" : "hello",<br> "test2" : [ "ok", "ok1", "ok2"] <br> "test3" : { "sub1" : [0,1,2,3],<br> "sub2" : 1}<br> }
And the path is + value:
test3/sub1/2 + 4
ie after changing the dictionary should be this:
{ "test1" : "hello",<br> "test2" : [ "ok", "ok1", "ok2"] <br> "test3" : { "sub1" : [0,1,4,3]<br> "sub2" : 1}<br> }
October 8th 19 at 01:33
2 answers
October 8th 19 at 01:35
Solution
Here is the solution.
gist.github.com/2168749
I apologize for the captaincy, only now I understand what is required. gist.github.com/c454616b6168892b1aba: shorter version. - kaylah.Friesen commented on October 8th 19 at 01:38
Thank you! But there is one minus — recursion. Although it is quite suitable, too :) - Gennaro.Ebert commented on October 8th 19 at 01:41
This is a tail recursion. It can be easily converted into a cycle. By the way, most compilers do this automatically, but unfortunately about Python I don't know whether. - luciano.Schmi commented on October 8th 19 at 01:44
October 8th 19 at 01:37
dict['test3']['sub1'][2] = 4
If you still need to select test3 and sub1 from string 1 regexp. - kaylah.Friesen commented on October 8th 19 at 01:40
I don't know... talking about the software to do it with input data. :)
Sobssno already done see below - Gennaro.Ebert commented on October 8th 19 at 01:43

Find more questions by tags PythonDictionaries of