os.path module provides exists(path), isdir(path), and isfile(path) to check for the existence of files and directories : Path : File PYTHON TUTORIALS


PYTHON TUTORIALS » File » Path »

 

os.path module provides exists(path), isdir(path), and isfile(path) to check for the existence of files and directories


import os


print os.path.exists("/dir1")
print os.path.isdir("/dir2")
print os.path.isfile("/test.doc")



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo File
» Path