ABC23 发表于 2018-4-9 16:32:45

单链表插入元素出错,疑问

class Node(object):
        def __init__(self, data, next=None):
                self.data = data
                self.next = next
        ...
----------------------------------------

n1 = Node       
n2 = Node('A', None)
n3 = Node('B', n2)
---------------------------------------------
当我们调用n1.next = n3,为什么会出现AttributeError??

ABC23 发表于 2018-4-13 17:22:15

are u kidding me??
页: [1]
查看完整版本: 单链表插入元素出错,疑问