On this page
genericpath.exists
Prev: genericpath.commonprefix | Up: genericpath | Next: genericpath.getatime
Rel: genericpath.commonprefix, genericpath.getatime, genericpath.getctime, genericpath.getmtime
Ref: docs.python.org — genericpath.exists
Tags: #public #python3 #stdlib #genericpath
Import
import genericpath
from genericpath import exists
Signature & Overview
genericpath.exists(path)
Test whether a path exists. Returns False for broken symbolic links
Usage
import os
from pathlib import Path
import tempfile
with tempfile.TemporaryDirectory() as tmp:
assert os.path.exists(tmp) is True
Gotchas
- Import via
os.path.existsorPath.exists(), notgenericpathdirectly; returnsFalsefor broken symlinks.
REPL Inspect
from genericpath import exists
help(exists)
Linked from
- tuts/python3/stdlib_module/genericpath
- tuts/python3/stdlib_module/genericpath/commonprefix
- tuts/python3/stdlib_module/genericpath/getatime
- tuts/python3/stdlib_module/genericpath/getctime
- tuts/python3/stdlib_module/genericpath/getmtime
- tuts/python3/stdlib_module/genericpath/getsize
- tuts/python3/stdlib_module/genericpath/isdevdrive
- tuts/python3/stdlib_module/genericpath/isdir
- tuts/python3/stdlib_module/genericpath/isfile
- tuts/python3/stdlib_module/genericpath/isjunction
- tuts/python3/stdlib_module/genericpath/islink
- tuts/python3/stdlib_module/genericpath/lexists
- tuts/python3/stdlib_module/genericpath/samefile
- tuts/python3/stdlib_module/genericpath/sameopenfile
- tuts/python3/stdlib_module/genericpath/samestat
Related notes
- tuts/python3/stdlib_module/genericpath/commonprefix Linked here; links to this page; shared tags: #genericpath, #stdlib
- tuts/python3/stdlib_module/genericpath/getatime Linked here; links to this page; shared tags: #genericpath, #stdlib
- tuts/python3/stdlib_module/genericpath/getctime Linked here; links to this page; shared tags: #genericpath, #stdlib
- tuts/python3/stdlib_module/genericpath/getmtime Linked here; links to this page; shared tags: #genericpath, #stdlib
- tuts/python3/stdlib_module/genericpath Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/genericpath/getsize links to this page; shared tags: #genericpath, #stdlib
- tuts/python3/stdlib_module/genericpath/isdevdrive links to this page; shared tags: #genericpath, #stdlib
- tuts/python3/stdlib_module/genericpath/isdir links to this page; shared tags: #genericpath, #stdlib
- tuts/python3/stdlib_module/genericpath/isfile links to this page; shared tags: #genericpath, #stdlib
- tuts/python3/stdlib_module/genericpath/isjunction links to this page; shared tags: #genericpath, #stdlib