There is no built in reverse
function in Python's str
object. What is the best way of implementing this?
If supplying a very concise answer, please elaborate on it's efficiency. Is the str
converted to a different object, etc.
How about:
This is extended slice syntax. It works by doing |
|||||||||||||||||||||
|
@Paolo's |
|||||||||||||||||
|
This question is protected to prevent "thanks!", "me too!", or spam answers by new users. To answer it, you must have earned at least 10 reputation on this site.
''.join((s[i] for i in xrange(len(s)-1, -1, -1)))
. – Dennis Mar 6 '13 at 6:49