Python OS.PATH Module os.path.exists() Method














































Python OS.PATH Module os.path.exists() Method



 
                    

                       os.path.exists() method

The os.path.exists() function is a built-in function provided by the os module. This function takes the path file and returns 'true' if the file is present. If the file is not present, then the function returns 'false' .

Syntax:
os.path.exists(path)

Parameter:
path: A path-like object signify a file system path. A path-like object is either a string or bytes object signify a path.

Return Type:
This function returns a Boolean value of class bool.It returns True if path exists otherwise returns False.

Use of os.path.exists() method

Output:-
True
False


More Articles of shobha dhande:

Name Views Likes
Python OS.PATH Module os.path.normcase() Method 370 0
Python OS.PATH Module os.path.exists() Method 593 1
Python OS.PATH MODULE os.path.lexists() Method 296 1
Python OS.PATH MODULE os.path.samestat() Method 325 1
Python OS.PATH MODULE os.path.getsize() Method 402 1
Python OS..PATH MODULE os.path.getctime() Method 386 1
Python OS.PATH MODULE os.path.getmtime() Method 482 1
Python OS.PATH MODULE os.path.getatime() Method 313 1
Python OS.PATH MODULE os.path.splitdrive() Method 400 0
Python OS.PATH MODULE os.path.splitext() Method 393 0
Python OS.PATH MODULE os.path.split() Method 356 0
Python OS.PATH MODULE os.path.sameopenfile() Method 288 0
Python OS.PATH MODULE os.path.samefile() Method 365 0
Python OS.PATH MODULE os.path.relpath() Method 335 0
Python OS.PATH MODULE os.path.realpath() Method 491 0
Python OS.PATH MODULE os.path.join(path, *paths) Method 352 0
Python OS.PATH MODULE os.path.normpath() Method 432 0
Python OS.PATH MODULE os.path.ismount(path) Method 293 0
Python OS.PATH MODULE os.path.link() Method 325 0
Python OS.PATH MODULE os.path.isfile(path) Method 293 0
Python OS.PATH MODULE os.path.isdir() Method 515 0
Python OS.PATH MODULE os.path.dirname() Method 354 0
Python OS.PATH MODULE os.path.isabs() Method 275 0
Python OS.PATH MODULE os.path.commonprefix() Method 304 0
Python OS.PATH MODULE os.path.commonpath() Method 294 0
Python OS.PATH MODULE os.path.basename() Method 297 0
Python OS.PATH MODULE os.path.abspath() Method 488 0
Python OS MODULE os.access() Method 353 0
Python OS MODULE os.get_terminal_size() Method 410 0
Python OS MODULE os.umask() Method 402 1
Python OS MODULE os.DirEntry.stat() Method 381 1
Python OS MODULE os.DirEntry.path Attribute 416 1
Python OS MODULE os.DirEntry.name Attribute 296 1
Python OS MODULE os.DirEntry.is_symlink() Method 287 1
Python OS MODULE os.DirEntry.is_dir() Method 468 1
Python OS MODULE os.scandir() Method 443 1
Python OS MODULE os.environ 711 1
Python OS MODULE Introduction to OS Module 311 1
Python OS MODULE os.system() Method 325 1
Python OS MODULE os.getpid() 344 1
Python OS MODULE os.getlogin() 356 1
Python OS MODULE os.getgroups() Method 310 1
Python OS Module os.getgrouplist() Method 331 1
Python OS MODULE os.getuid() and os.setuid() Method 754 1
Python OS MODULE os.getgid() and os.setgid() Method 346 1
Python OS MODULE os.geteuid() and os.seteuid() Method 466 1
Python OS MODULE os.getegid() and os.setegid() Method 314 1
Python OS MODULE Difference between Real, Effective and Saved UserID 303 1
Python OS MODULE Current Working Directory 354 1
Python OS MODULE : os.getenvb() , os.get_exec_path() 471 1

Comments