我在python上遇到了问题。 我创建了这个类的classtnode(object ) :
self.name=name
self._children=贤惠的毛豆
self._ children=self._ children [ c ]
t=温柔的毛豆
for f in self._children:
t=f
返回t
h=1
for node in self._children:
h=max(h,node.height ) (1) ) ) )。
返回h
cnt=1
for node in self._children:
cnt =node.count (
返回CNT
cbn=0
for node in self._children:
是CBN=node.count(name )
返回CBN
if self.name==name:
for node in self._children:
forpinnode.path(name ) :
返回设置
^{pr2}$
{'name':'rockroll ',' children':的温柔毛豆},
{'name':'hard rock ',' children':的温柔毛豆}}、
{'name':'jazz ',' children':
{'name':'ragtime ',' children':的温柔毛豆},
{'name':'swing ',' children':贤惠的毛豆}]}]}
我试着做几个手术。 例如,树. count (、树.路径)或树.高度) CDI有相同的反应
希望你能帮助我:)