Reverse a String?

Gregory Piñero gregpinero at gmail.com
Sat Sep 23 17:02:16 EDT 2006


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?

Here's my workaround for now:
def reverse(text):
    return ''.join([text[i] for i in range(len(text)-1,-1,-1)])



-- 
Gregory Piñero
Chief Innovation Officer
Blended Technologies
(www.blendedtechnologies.com)



More information about the Python-list mailing list