Reverse function python? How to use?

Kay Schluehr kay.schluehr at
Mon Oct 30 09:20:39 CET 2006

frankie_85 wrote:
> Ok I'm really lost (I'm new to python) how to use the reverse function.
> I made a little program which basically the a, b, c, d, e which I have
> listed below and basically I want it th result to be printed reverse so
> instead doing "print e, d, c, b, a", I'd like to use the reverse
> function

You can use extended slice operators [1]

This function call should do what yo expect

print [e, d, c, b, a][::-1]

[1] Does anyone know where to find a comprehensible description of
enhanced slices in the Python docs besides an an aged "What's new?"
column? Or is it intended that newbies read this ?

More information about the Python-list mailing list