HowTo distinguish between File and Directory

Peter Hansen peter at engcorp.com
Mon Jan 19 14:53:38 EST 2004


Scott F wrote:
> 
> On Win32, is there a function in the standard modules that can take a
> pathname and return whether it refers to a File or a Directory?

import os
os.path.isfile(name)
os.path.isdir(name)

Is that adequate?

-Peter



More information about the Python-list mailing list