On Mon, 09 Apr 2007 01:43:11 -0700, 7stud wrote:

>> Is there a simple function to generate a list like ['a', 'b', 'c', ...
>> 'z']?   The range() just can generate the numeric list.
> 
> Not very simple, but how about a list comprehension:
> 
> import string
> 
> lst = [char for char in string.letters[:26] ]
> print lst

Anytime you write a list comp like [x for x in thing] that should be a
warning that you shouldn't be writing a list comp.

lst = list(string.letters[:26])


-- 
Steven.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to