Copy or View nested Python dictionary - stop at certain depth

Viewed 31

I have a nested Python dictionary. I want to either deep copy it or view it (essentially the same problem).

But I don't want to recurse down the full depth. Maybe I just want to view first level (so just the keys), or maybe first 2 levels - so keys and their immediate value.

I could easily write my own utility. But I was thinking what I'm doing should be pretty common. Am I missing an obvious tool that could do this?

0 Answers
Related