generating a liste of characters

Shane Geiger sgeiger at ncee.net
Wed Dec 3 09:22:28 EST 2008


import string
alphabet=list(string.letters[0:26])
print alphabet



Yves Dorfsman wrote:
> Is there any built in way to generate a list of characters, something
> along the line of range('a'-'z') ?
>
> Right now I am using:
>
>   chars  = [ chr(l)  for l in range(0x30, 0x3a) ] # 0 - 9
>   chars += [ chr(l)  for l in range(0x41, 0x5b) ] # A - Z
>   chars += [ chr(l)  for l in range(0x61, 0x7b) ] # a - z
>
> Is there a better, more straight forward way of doing that ?
>
>
>
> Thanks.
>
>
>
> Yves.
> http://www.sollers.ca/blog/2008/swappiness
> http://www.sollers.ca/blog/2008/swappiness/.fr
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>   


-- 
Shane Geiger
IT Director
National Council on Economic Education
sgeiger at ncee.net  |  402-438-8958  |  http://www.ncee.net

Leading the Campaign for Economic and Financial Literacy




More information about the Python-list mailing list