Reverse a list in python -
this question has answer here:
- how can reverse list in python? 27 answers
how reverse list in python? tried:
a = ["abc", "def", "ijk", "lmn", "opq", "rst", "xyz"] print a = reversed(a) print
but <listreverseiterator object @ 0x7fe38c0c>
when print a
2nd time.
use a[::-1]
its pythonic way of doing it.
Comments
Post a Comment