ID EN
OS Path

samefile

Python 3.11

Return True if both pathname arguments refer to the same 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.

Syntax

PYTHON
os.path.samefile(path1, path2)

See Also

os.stat() Availability path-like object