الفرق بين المراجعتين ل"Python/pathlib/Path/samefile"
اذهب إلى التنقل
اذهب إلى البحث
(أنشأ الصفحة ب'== التابع Path.cwd == يعيد كائن مسار جديدًا يمثّل المسار الحالي (بشكل مشابه للتابع os.getcwd)<syntaxhighlight lan...') |
|||
سطر 1: | سطر 1: | ||
− | == التابع Path. | + | == التابع 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.<syntaxhighlight lang="python3"> | |
+ | >>> p = Path('spam') | ||
+ | >>> q = Path('eggs') | ||
− | + | >>> p.samefile(q) | |
+ | False | ||
+ | |||
+ | >>> p.samefile('spam') | ||
+ | True | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | New in version 3.5. |
مراجعة 07:44، 3 أغسطس 2018
التابع 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.