Is this what you want? >>> import string >>> ltrs = string.lowercase >>> [''.join([a,b]) for a in ltrs for b in ltrs]
HTH, Alan G. ----- Original Message ----- From: "Chris Shenton" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Thursday, July 28, 2005 6:59 PM Subject: [Tutor] range()-like function to generate aa, ... az, ..., zz ? > 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. > > _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
