If I have node.child1.child2, can I use hasattr(node, 'child1.child2') effectively? Will it error if there’s no child1 or simply return false?
If I have node.child1.child2 , can I use h asattr(node, ‘child1.child2’) effectively? Will it
Share
hasattrdoesn’t take a dotted name like that and navigate down attribute chains. But you can write a function to do it: