On Mon, Jun 29, 2009 at 2:31 PM, Tim Pinkawa<timpink...@gmail.com> wrote: > I am curious about it being slow, though. Is there a faster way to get > the contents of a directory than os.listdir() or is there a faster way > to see if an element is in a list other than "x in y"? I believe > 'which' will terminate once it finds any match, which mine does not, > but that can be fixed by adding a break after the print.
To answer my own question on this specific case, you could check with os.access which may be faster. I am still curious, Christian, if your issue with it being slow was that "os.listdir is slow" or "os.listdir is slow in this case". -- http://mail.python.org/mailman/listinfo/python-list