Am Wed, 22 Jun 2005 17:57:14 +0200 schrieb Riccardo Galli: > Hi, > I noticed that when I use os.listdir I need to work with absolute paths > 90% of times. > While I can use a for cycle, I'd prefere to use a list comprehension, > but it becomes too long.
Hi, I like it. But as you noticed, too, "join" would be better than "abs". Example: # mylistdir.py import os import sys def mylistdir(dir, join=False): for file in os.listdir(dir): yield os.path.join(dir, file) print list(mylistdir(sys.argv[1])) Thomas -- Thomas Güttler, http://www.thomas-guettler.de/ -- http://mail.python.org/mailman/listinfo/python-list