På 15. jan 2005 kl. 16:16 skrev .removethis.:

>>> import glob
>>> from os.path import isfile
>>> print filter(isfile, glob.glob('/tmp/*')) # can use patterns

Nice example of when filter() is better than list comprehension.

[f for f in glob.glob("/tmp/*") if isfile(fi)]
is a bit too verbose, the iteration is a totally uninteresting part here.


--
Stian Søiland
Trondheim, Norway
http://www.soiland.no/
                     =/\=

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

Reply via email to