Why these don't work??

nn pruebauno at latinmail.com
Thu Apr 8 20:31:13 CEST 2010



M. Hamed wrote:
> I'm trying the following statements that I found here and there on
> Google, but none of them works on my Python 2.5, are they too old? or
> newer?
>
> "abc".reverse()
> import numpy

reverse does not work on strings but does work on lists:
>>> x=list("abc")
>>> x.reverse()
>>> x
['c', 'b', 'a']

or maybe this:
>>> ''.join(reversed("abc"))
'cba'

as far as numpy you need to install it first:

http://pypi.python.org/pypi/numpy/





More information about the Python-list mailing list