Pedro Werneck wrote:
> On Thu, 22 Sep 2005 23:26:58 -0400
> Jeff Schwab <[EMAIL PROTECTED]> 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' .
>
>
> If you want arbitrary sequences, you may use somethi
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 re
>>> def char_set(a_z, all_chars="".join(map(chr, range(256:
... return re.compile("[%s]" % a_z).findall(all_chars)
...
>>>
Jeff Schwab wrote:
> [EMAIL PROTECTED] 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
> >
> > abcdefghi
On Thu, 22 Sep 2005 23:26:58 -0400
Jeff Schwab <[EMAIL PROTECTED]> 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' .
If you want arbitrary sequences, you may use something like:
>>> [chr(x) for x in xrang
[EMAIL PROTECTED] 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 g
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
Others:
ascii_letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKL
What's the best way to generate a sequence of characters in Python? I'm
looking for something like this Perl code: 'a' .. 'z' .
--
http://mail.python.org/mailman/listinfo/python-list