Noah wrote:
> I have a list of tuples
>     [('a', 1.0), ('b', 2.0), ('c', 3.0)]
> I want to reverse the order of the elements inside the tuples.
>     [(1.0,'a'), (2.0, 'b'), (3.0, 'c')]

Python 2.4+:

   y = [tuple(reversed(t)) for t in y]

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to