Super Easy Way to Reverse a String in Python
Here’s what I discoved today. To reverse a string in Python you just do:
text[::-1]
It’s that easy! Here is a more filling example:
>>> text='greg'
>>> print text[::-1]
gerg
And finally here is why it works, for the curious.
[...] Saw this easy way to reverse a string in python today, over at Answer My Searches [...]