About 362,000 results
Open links in new tab
  1. python - How do I reverse a list or loop over it backwards? - Stack ...

    How do I iterate over a list in reverse in Python? See also: How can I get a reversed copy of a list (avoid a separate statement when chaining a method after .reverse)?

  2. Best way to create a "reversed" list in Python? - Stack Overflow

    In Python, what is the best way to create a new list whose items are the same as those of some other list, but in reverse order? (I don't want to modify the existing list in place.) Here is one so...

  3. loops - Traverse a list in reverse order in Python - Stack Overflow

    Feb 10, 2009 · How do I traverse a list in reverse order in Python? So I can start from collection[len(collection)-1] and end in collection[0]. I also want to be able to access the loop …

  4. Python reverse list - Stack Overflow

    Sep 9, 2012 · List reverse can be done using more than one way. As mentioned in previous answers two are very prominent, one with reverse() function and two with slicing feature. I'm …

  5. How do I reverse a part (slice) of a list in Python?

    How do I reverse a part (slice) of a list in Python? Asked 14 years, 11 months ago Modified 3 years, 7 months ago Viewed 83k times

  6. python - Sort a list in reverse order - Stack Overflow

    Apr 16, 2017 · Sort a list in reverse order Asked 8 years, 8 months ago Modified 1 year, 11 months ago Viewed 72k times

  7. How to reverse a list without modifying the original list in Python

    Jan 21, 2017 · from copy import deepcopy L = deepcopy(R) But in practise there is rarely a need to make explicit copies. Python provides e.g. the reversed built-in that can be used to iterate …

  8. python - How to sort a list with two keys but one in reverse order ...

    The special case (all keys should be sorted in the same order) is python - Sort a list by multiple attributes? - Stack Overflow -- although it also have some comment explaining how to sort in …

  9. python - How can I get a reversed copy of a list (avoid a separate ...

    This is the real answer to this question. It returns a reversed list in-place so you can do it inside of list comprehensions.

  10. python - What's "better" the reverse method or the reversed built …

    foo.reverse() actually reverses the elements in the container. reversed() doesn't actually reverse anything, it merely returns an object that can be used to iterate over the container's elements …