On this page
ntpath.samefile
Prev: ntpath.relpath | Up: ntpath | Next: ntpath.sameopenfile
Rel: ntpath.abspath, ntpath.basename, ntpath.commonpath, ntpath.commonprefix
Ref: docs.python.org — ntpath.samefile
Tags: #public #python3 #stdlib #ntpath
Import
import ntpath
from ntpath import samefile
Signature & Overview
ntpath.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 ntpath
assert ntpath.samefile('.', ntpath.abspath('.')) is True
Gotchas
- Compares device + inode via
os.stat().
REPL Inspect
from ntpath import samefile
help(samefile)
Linked from
Related notes
- tuts/python3/stdlib_module/ntpath/relpath Linked here; links to this page; shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath/sameopenfile Linked here; links to this page; shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/ntpath/abspath Linked here; shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath/basename Linked here; shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath/commonpath Linked here; shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath/commonprefix Linked here; shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath/dirname shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath/exists shared tags: #ntpath, #stdlib
- tuts/python3/stdlib_module/ntpath/expanduser shared tags: #ntpath, #stdlib