On this page
posixpath.samefile
Prev: posixpath.relpath | Up: posixpath | Next: posixpath.sameopenfile
Rel: posixpath.abspath, posixpath.basename, posixpath.commonpath, posixpath.commonprefix
Ref: docs.python.org — posixpath.samefile
Tags: #public #python3 #stdlib #posixpath
Import
import posixpath
from posixpath import samefile
Signature & Overview
posixpath.samefile(f1, f2)
Test whether two pathnames reference the same actual file or directory This is determined by the device number and i-node number and raises an exception if an os.stat() call on either pathname fails.
Usage
import posixpath
assert posixpath.samefile('.', posixpath.abspath('.')) is True
Gotchas
- Compares device + inode via
os.stat().
REPL Inspect
from posixpath import samefile
help(samefile)
Linked from
Related notes
- tuts/python3/stdlib_module/posixpath/relpath Linked here; links to this page; shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath/sameopenfile Linked here; links to this page; shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/posixpath/abspath Linked here; shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath/basename Linked here; shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath/commonpath Linked here; shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath/commonprefix Linked here; shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath/dirname shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath/exists shared tags: #posixpath, #stdlib
- tuts/python3/stdlib_module/posixpath/expanduser shared tags: #posixpath, #stdlib