Reverse a String?

Robert Kern robert.kern at gmail.com
Sat Sep 23 17:04:18 EDT 2006


Gregory Piñero wrote:
> Is my mind playing tricks on me? I really remember being able to
> reverse a string as in:
> 
> text='greg'
> print text.reverse()
>>> 'gerg'
> 
> Is it possible thats in some Python install and not in others?  I just
> switched to linux.
> 
> In any case, can we get that added?

Not in that form, no, since this already exists:

   text[::-1]

-- 
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




More information about the Python-list mailing list