ll= [1,2,3,4,5]
print ll[::-1]
ll.reverse()
for l in reversed(ll):
print l
倒序读取文件:
with open(filepath,'rb') as fo: lines = fo.readlines() #lines是一个list for line in reversed(lines): #倒序读取行 print line
ll= [1,2,3,4,5]
print ll[::-1]
ll.reverse()
for l in reversed(ll):
print l
倒序读取文件:
with open(filepath,'rb') as fo: lines = fo.readlines() #lines是一个list for line in reversed(lines): #倒序读取行 print line