On Thu, 2005-07-28 at 13:59 -0400, Chris Shenton wrote:
> I'm looking for a range()-like function which could generate a list of
> character-oriented tokens, like to iterate over all two-character
> sequences like:
>
> pseudorange('aa', 'zz') would generate:
> aa, ab, ..., az, ba, ..., za, ..., zz
>
> range() doesn't do character iteration, and I'm sure I could write a
> dumb function to do it, but was wondering if there was something more
> generic -- e.g., later I might want
>
> pseudorange('aaa', 'mmm')
>
> Anyway, is there a function to iterate through a range of character
> strings similar to this?
>
> Thanks.
My small controbution to PyTuyo:
>>> twoLetterSequence = [ "%c%c" % (x, y) for x in range(ord('a'),
ord('z')+1) for y in range(ord('a'), ord('z')+1)]
Ziyad.
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor