Ismael Garrido wrote:
Kent Johnson wrote:
Are you creating a tree to represent XML data? There are many packages
available that do this. You might want to look at ElementTree which is
one of the easiest to use. In fact, even if you aren't trying to
represent XML you might find ElementTree useful
Ismael Garrido wrote:
The idea of the class is to be able to create a "tree". Where each node
can have subnodes, which in turn can have their subnodes...
Are you creating a tree to represent XML data? There are many packages available that do this. You
might want to look at ElementTree which is o
Ismael Garrido schrieb:
Hello.
This is my code:
class Node:
def __init__(self, tag, value=None, **kwargs):
self.tag = tag
self.value = value
self.kwargs = kwargs
self.childs = []
def addChild(self, tag, value=None, **kwargs):
node = Node(tag, value, kwargs)
Hello.
This is my code:
class Node:
def __init__(self, tag, value=None, **kwargs):
self.tag = tag
self.value = value
self.kwargs = kwargs
self.childs = []
def addChild(self, tag, value=None, **kwargs):
node = Node(tag, value, kwargs)
self.childs.appen