Net-informations.com
SiteMap  | About    

Check if a File or Directory Exists

Check whether a file exists using Python

The os.path.isfile(path) return True if path is an existing regular file.

example

If the file "my_file.txt" exist in the current path, it will return true else false.

Check whether a directory/Folder exists using Python

From python 3.4 a newer the pathlib module is recommended to be used. It offers a more object oriented approach than functions on python 2 os package.

example

Checking for file or directory exists using Python

example









net-informations.com (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.