How to identify whether a file is normal file or directory November 17, 2022 by Tarik os.path.isdir() and os.path.isfile() should give you what you want. See: http://docs.python.org/library/os.path.html