Why these don't work??
MRAB
python at mrabarnett.plus.com
Thu Apr 8 14:43:44 EDT 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()
Lists have a .reverse() method which reverses the list elements
in-place, but strings don't because they're immutable.
There's a built-in function reversed() which returns an iterator over an
iterable object, eg a string:
print reversed("abc")
for c in reversed("abc"):
print c
It's all in the documentation.
> import numpy
numpy isn't part of the standard library; you'd need to download and
install it.
More information about the Python-list
mailing list