[Tutor] Can I tell me anyone about [x.lower() for x in lst]
Remco Gerlich
scarblac@pino.selwerd.nl
Mon, 3 Sep 2001 12:59:35 +0200
On 0, Abhiram Singh Kushwah <abhiramkushwah@rediffmail.com> wrote:
> Hi All,
>
> Can I tell me anyone about the following code:
>
> >>> import string
> >>> lst = ['ONE', 'TWO', 'THREE']
> >>> newlst = [x.lower() for x in lst]
> File "<stdin>", line 1
> newlst = [x.lower() for x in lst]
>
> I am using python1.5 on Red Hat Linux 7.1.
> Does the facility "[x.lower() for x in lst]" not
> available in python1.5 ?
No, these are list comprehensions, they were new in 2.0, which is almost a
year old now.
--
Remco Gerlich