So I have a list which acts as a 'map' of sorts, and a dict which is pulled from a JSON file.
For this example, lets say they look like this:
L = ['One', 'Two', 'Three']
D = {
"One": {
"Two": {
"Three": {
"Four": "String"
}
}
}
}
I need a function for my game.
I will be passing it two things: L
and a Object
.
Note that L
just leads to "Three"
so thats what I want to replace. Though, I could be replacing "Four"
or any other element at an unknown debth.
What I'm replacing could be a string
, list
, or dict
, and I could be replacing it with any other object, including None
, or a bool
.
The structure of D
needs to remain intact, besides the value being replaced.