use only files but ignore directories on Windows

Jerry Hill malaclypse2 at gmail.com
Thu May 13 16:30:47 EDT 2010


On Thu, May 13, 2010 at 4:12 PM, albert kao <albertkao3 at gmail.com> wrote:
> My program plan to use only files but ignore directories on Windows.
> I google but do not find some functions like
> bool isFile(string)
> bool isDirectory(string)
> Please help.

You're looking for the functions os.path.isfile() and os.path.isdir()

See http://docs.python.org/library/os.path.html for details.

-- 
Jerry



More information about the Python-list mailing list