Python/pathlib/Path/samefile

من موسوعة حسوب

التابع Path.samefile

Return whether this path points to the same file as other_path, which can be either a Path object, or a string. The semantics are similar to os.path.samefile() and os.path.samestat().

An OSError can be raised if either file cannot be accessed for some reason.

>>> p = Path('spam')

>>> q = Path('eggs')

>>> p.samefile(q)
False

>>> p.samefile('spam')
True

New in version 3.5.