[Tutor] listdir()

Ole Jensen learning.python at dbmail.dk
Fri Jul 2 16:02:35 EDT 2004

Jeff Shannon wrote:
> Look into the os.isdir() function, which will tell you easily whether 
> a given pathname is a directory or not.  You will, however, need to do 
> your own sorting if you want directories to appear before regular 
> files.  (Of course, you'd probably want to sort entries anyhow, since 
> IIRC the ordering returned by os.listdir() is arbitrary.)

I guess you mean os.path.isdir()... I'll have a look at it.

IIRC - what's that?


More information about the Tutor mailing list