On Jun 9, 7:39 pm, james_027 <cai.hai...@gmail.com> wrote:
>
> I am trying to reverse the order of my list of tuples and its is
> returning a None to me. Is the reverse() function not allow on list
> containing tuples?


list.revese() is an in-place operation! don't try to assign the return
value back to your list!

>>> lst = [(x, x+1) for x in range(5)]
>>> lst
[(0, 1), (1, 2), (2, 3), (3, 4), (4, 5)]
>>> lst.reverse()
>>> lst
[(4, 5), (3, 4), (2, 3), (1, 2), (0, 1)]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to