Reverse loop on list


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  1. >>> a
  2. ['one', 'two', 'three']
  3. >>> for i in a[::-1]:
  4. ... print i
  5. ...
  6. three
  7. two
  8. one

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.