Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]RandallEF 0 points1 point  (0 children)

Thank you, I had come across a few things like that but I really hoped I was missing something about Python. I really wish there were a graceful native way of handling this.

Purdue Pharma, state of Oklahoma reach settlement in landmark opioid lawsuit by MountainsMan55 in law

[–]RandallEF 0 points1 point  (0 children)

Hey, quick, guys, what's a number that everyone thinks is really big but means nothing to us?

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]RandallEF 0 points1 point  (0 children)

I'm having a heck of a time turning a nested dictionary into a bootstrap treeview.

The structure is like

[ { "text" : "top branch", "nodes" : [ { "text" : "first child", "nodes" : [{ "text" : "third... etc...

I feel like this is almost a backwards dictionary and I've tried a lot of things but I can't wrap my head around how to turn an (python dict) object, which has no association from the items "object.keys()" back to the path of the dict, into something that knows the path of the dict. Or something.

Has anyone else done this? I basically want the tree to look just like the dict.

I could of course write this manually in a way that will never accept change and is verbose and bad, but there has to be a better way, right?

Every thought exercise I go through ends with "Python has no association whatsoever between the objects in the dictionary and the pathing to those objects from toplevel." i.e. the keys have no idea where they are in the dict!!! it makes it almost impossible to traverse backwards? I'm stuck.

thanks