On Fri, Sep 28, 2007 at 04:59:26PM -0700, Christopher Spears wrote:
> How do I get around this?  Is there a better way to
> write this script?  I can't figure out how to loop
> through a string starting from the last character.

A string is a sequence of chars, and you can use slices with it [1].

In [23]: a = 'abcdef'

In [24]: a[::-1]
Out[24]: 'fedcba'

Tiago.

[1] - http://docs.python.org/lib/typesseq.html

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to