Confessions of a Python fanboy

Dave Angel davea at ieee.org
Thu Jul 30 20:28:11 CEST 2009


superpollo wrote:
>> <snip>
>
> how to reverse a string in python? must i usa a temp? like:
>
> >>> s = "ciccio"
> >>> l = list(s)
> >>> l.reverse()
> >>> s = "".join(l)
> >>> s
> 'oiccic'
> >>>
>
> ???
>
> bye
>
>
> </div>
>
simply     s = s[::-1]

DaveA




More information about the Python-list mailing list