How to print the elements of a linked list?

后端 未结 2 632
一生所求
一生所求 2020-12-19 12:17

I\'m dong a Node exercise on python today. I seem to have accomplished a part of it, but it is not a complete success.

class Node:
    def __init__(self, ca         


        
2条回答
  •  醉酒成梦
    2020-12-19 13:04

    def printLinkedList(self):
        node = self.head
        while node != None:
            print(node.getData())
            node = node.getNext()
    

提交回复
热议问题