invert or reverse a string... warning this is a rant
Thu Oct 19 18:09:49 CEST 2006
rick <ath-admin at vt.edu> writes:
> Why can't Python have a reverse() function/method like Ruby?
> x = 'a_string'
> # Reverse the string
> print x[::-1]
> The Ruby approach makes sense to me as a human being. The Python
> approach is not easy for me (as a human being) to remember. Can that
> be changed or should I just start blindly memorizing this stuff?
You could use:
That also looks a little bit weird, but it combines well-known Python
More information about the Python-list