Remove items from a list

Tor Iver Wilhelmsen tor.iver.wilhelmsen at broadpark.no
Wed Sep 8 04:23:01 EDT 2004


"Stan Cook" <scook at elp.rr.com> writes:

> for each in _dbases:
>     if each[-4:] <> ".dbf":

List comprehension to the rescue!

_dbases = [each for each in _dbases if each[-4:] == ".dbf"]



More information about the Python-list mailing list