Re: a little parsing challenge ☺
wxjmfauth at gmail.com
Wed Jul 20 09:54:22 CEST 2011
On 20 juil, 09:29, Ian Kelly <ian.g.ke... at gmail.com> wrote:
> Otherwise, here's another non-DRY solution:
> >>> from itertools import izip
> >>> for i, c in izip(reversed(xrange(len(s))), reversed(s)):
> Unfortunately, this is one space where there just doesn't seem to be a
> single obvious way to do it.
Well, I see. Thanks.
There is still the old, brave solution, I'm in fact using.
>>> s = 'abcd'
>>> for i in xrange(len(s)-1, -1, -1):
... print i, s[i]
DRY? acronym for ?
More information about the Python-list