A suggestion for a possible Python module

Erik Max Francis max at alcyone.com
Mon Mar 3 20:22:49 EST 2003


Lance LaDamage wrote:

> I have noticed that there is one thing that everyone wishes to do in
> Python
> ... reverse a string.

Who's everyone?  I can't remember needing desperately to reverse a
string once in my entire programming life.

> As you know, in Visual Basic, the function for
> performing this operation is indeed StrReverse(s).

It's pretty trivial in Python as it is:

>>> s = 'hello'
>>> l = list(s)
>>> l.reverse()
>>> ''.join(l)
'olleh'

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ I am the king of sorrow
\__/ Sade
    REALpolitik / http://www.realpolitik.com/
 Get your own customized newsfeed online in realtime ... for free!




More information about the Python-list mailing list