We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
tree = Tree() tree.create_node("Harry", "harry") tree.create_node("Jane", "jane", parent="harry") n= tree.get_node("jane") n.identifier=("xyz") tree.get_node("xyz") ### returns None tree.get_node("jane") ### return a Node object whose identifier is "xyz" !
Hope you can address this,
Thnaks.
The text was updated successfully, but these errors were encountered:
The Tree class maintains a internal _nodes dictionary which is not updated on identifier and other changes.
Tree
_nodes
You may want to use a reimplementation of treelib called anytree
from anytree import Node from anytree import find_by_attr root = Node('harry') Node('jane', parent=root) n = find_by_attr(root, 'jane') n.name = 'xyz' find_by_attr(root, 'xyz') ### returns Node('/harry/xyz') find_by_attr(root, 'jane') ### returns None
HTH
Sorry, something went wrong.
Perfect, used anytree and it is solved now. many thanks.
cceb0ef
Now treelib supports node attribute modification:
from treelib import Tree, Node tree = Tree() tree.create_node("Harry", "harry") tree.create_node("Jane", "jane", parent="harry") tree.update_node("jane", identifier='xyz') assert tree["xyz"].identifier == 'xyz'
from treelib import Tree, Node tree = Tree() tree.create_node("Harry", "harry") tree.create_node("Jane", "jane", parent="harry") tree.update_node("harry", identifier='xyz') assert tree.root == 'xyz' assert tree['jane'].bpointer == 'xyz'
caesar0301
No branches or pull requests
Hello,
Hope you can address this,
Thnaks.
The text was updated successfully, but these errors were encountered: