我想在脚本中创建一个 Node 对象并将其用作实例变量。在下面显示的代码中,该行root = Node('')
给了我一个错误,说未定义的变量 Node.js。
if __name__ == '__main__':
#url = ''
#processWords(url)
currentWord = []
root = Node('')
curr = root
words = ['adelaide', 'ahmedabad', 'calcutta', 'california', 'chicago', 'chennai', 'delhi', 'dubai', 'melbourne', 'mumbai']
process(words)
play()
class Node:
def __init__(self, char):
self.char = char
self.children = set()