as I am trying to do my python programming, I didn't know how to solve the situation in this case
class Node:
def __init__(self, name):
self.name = name
self.neighbours = []
a = Node('a')
b = Node('b')
c = Node('c')
d = Node('d')
e = Node('e')
a.neighbours = [d]
b.neighbours = [d, e]
c.neighbours = [e]
d.neighbours = [e]
e.neighbours = [a]
node_rela = {}
node_rela[a.name] = a.neighbours
print(node_rela)
The a.name is successfully shown as 'a', but I don't know why it can't apply to a.neighbours
{'a': [<__main__.Node object at 0x000002424BF53CD0>]}
How to solve the problem in this situation
Thanks a lot