Listing directory contents

Fredrik Lundh fredrik at pythonware.com
Wed May 23 13:13:09 EDT 2001


Christopher J McMillan wrote:
> Hello, newbie here!  I was wondering if there was a more efficient way
> to list the contents of my local working directory then what I'm using"
>
> os.listdir(os.getcwd())

what's so inefficient about that?

you can save some typing by using:

    os.listdir(".")

but I'm not sure it's really faster on any contemporary operating
system... (no time for benchmarks today, sorry ;-)

Cheers /F





More information about the Python-list mailing list