remove a list from a list
Fredrik Lundh
fredrik at pythonware.com
Fri Nov 17 20:19:56 CET 2006
Rares Vernica wrote:
> I have the following problem:
>
> I have a list like
> e = ['a', 'b', 'e']
> and another list like
> l = ['A', 'a', 'c', 'D', 'E']
> I would like to remove from l all the elements that appear in e
> case-insensitive. That is, the result would be
> r = ['c', 'D']
>
> What is a *nice* way of doing it?
r = [i for i in e if i not in l]
or use sets.
</F>
More information about the Python-list
mailing list