newbie-question about a list
bobueland at yahoo.com
bobueland at yahoo.com
Sat Nov 19 10:06:30 EST 2005
I've seen this construct in a script
>>> [x.capitalize() for x in ['a','b', 'c']]
['A', 'B', 'C']
I tried another myself
>>> [x+1 for x in [1,2,3]]
[2, 3, 4]
>>>
Apparently you can do
[function(x) for x in list]
I tried to find a description of this in "Library Reference" but
couldn't find it. Could somebody direct me where this type of construct
is described.
Bob
More information about the Python-list
mailing list