os.path.ismount() Method in PythonThe OS module in Python is used for providing the functions to interact with the operating systems. OS module is available in standard utility modules of Python. There is a portable way provided by the OS module for using operating system-dependent functionality. The "os.path" module is a sub-module of the OS module in Python, which is used for manipulating the common pathname. The os.path.ismount() method in Python is used for checking whether the given path is a mount point or not. The mount point in the file system is the point where various file systems have been mounted. Syntax:Parameters:path: The path-like object represents the path of a file system. This object can be either a string or bytes object which represents the path. Return type: This method returns a Boolean value of class "bool". This will return "True" if the given path is a mount point, and it will return "False" if the given path is not a mount point of the file system. To check if the given path is a mount point or not, we can write the following code:Code 1: Output: False Code 2:Output: True Explanation: In the above programs, as we have passed the path of the "C" drive, it gives output as False because there is no mount point in the "C" drive, but when we pass the path of "E" drive, we get the output as True, because the "E" drive is the mount point for a file system. ConclusionIn this tutorial, we have discussed how to check the mount point for the file system using Python.
Next TopicPython PyLab Module
|