While using python modules, sometime to understand python module more clear its good to read module file that how it work and integrate with other systems resources, what all options we could work with and how.For same its important to know python module file path which we could open in any editor for read purpose. So in this post we will see How to find Python Module file path.

Ways to check Module file path

To know module file path, there are many ways do it. let’s see some of them.

>>> import yaml
>>> print(yaml.__file__)

Like in above way, we can easily know module path and read it further details

There could be another way, but we may use OS module in it like below.

>>> import os
>>> print(os.path.dirname(yaml.__file__))

You can also use inspect module to print it, like below

>>> import inspect
>>> inspect.getfile(yaml)