Character Sequence Generation

Devan L devlai at gmail.com
Fri Sep 23 00:20:32 EDT 2005


Jeff Schwab wrote:
> mensanator at aol.com wrote:
> > Jeff Schwab wrote:
> >
> >>What's the best way to generate a sequence of characters in Python?  I'm
> >>looking for something like this Perl code: 'a' .. 'z' .
> >
> >
> >>>>import string
> >
> >
> >>>>print string.ascii_lowercase
> >
> > abcdefghijklmnopqrstuvwxyz
>
> Thanks.  Is there a good way to generate the characters dynamically?

''.join([chr(i) for i in range(97,123)])




More information about the Python-list mailing list