链表中的cur.next问题:
def append(self,num):
cur=self.__head
node=SingleNode(item=num)
if self.is_empty():
cur.item=node.item
else:
# cur=self.__head
while cur.next!=0:
cur=cur.next
cur.next=node
while cur.next!=0:
要改成:
while cur.next!=None:
应该是这里把cur跟数值做比较,所以编译器就不确定cur的类型了,这里的cur就不是我们之前定义的cur了,就没有next属性了。