# -*- coding: utf-8 -*-
"""
Created on Mon Feb 27 09:06:07 2017
@author: zzpp220
"""
class LinkList:
def __init__(self,val,link=None):
self.val=val
self.link=link
def printReversely(self):
if not self.val:
return None
stack=[]
while self:
stack.insert(0,self.val)
self=self.link
return stack
if __name__=="__main__":
l1=LinkList(4)
l2=LinkList(3,l1)
l3=LinkList(2,l2)
l4=LinkList(1,l3)
print l4.printReversely()
附件列表