OS module in Python provides functions for interacting with the operating system. OS comes under Python’s standard utility modules. This module provides a portable way of using operating system dependent functionality. os.path module is sub module of OS module in Python used for common path name manipulation.
os.path.samestat() method in Python is used to check whether the given stat tuples refer to the same file or not. A Stat tuple is an object that may have been returned by os.fstat(), os.lstat() or os.stat() method. It represents the status of the a path.
Syntax: os.path.samestat(stat1, stat2)
stat1: A stat tuple.
stat2: A stat tuple.
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 of os.path.samestat() method to check whether the given stat tuples refer to same file.
True True False
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.