os.path.samestat() in Python is used to check if a given tuple stat refers to the same file or not. Tuple Stat — it is an object that can be returned by the os.fstat (), os.lstat (), or os.stat () methods. It represents the state of the path.
Syntax: os.path.samestat (stat1, stat2)
stat1 : A stat tuple.
stat2 : A stat tuple. p>
Return Type: This method returns a Boolean value of class bool. This method returns True if both stat tuple refer to the same file otherwise returns false.
Code: Use os.path.samestat () method to check if whether these tuples refer to the same file.
| tr> |
True True False
Link: strong> https://docs.python.org/3/library/os.path .html