fir3net
PPS-Firenetbanner-780.5x190-30-03-17

How do I print the path of a Python module ?

To print the path of python module the command print [module].__file__. An example is shown below:

[root@webserver1 ~]# python
Python 2.4.3 (#1, Sep 21 2011, 19:55:41)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pexpect
>>> print pexpect.__file__
/usr/lib/python2.4/site-packages/pexpect.pyc

About the Author

RDonato

R Donato

Rick Donato is the Founder and Chief Editor of Fir3net.com. He currently works as a Principal Network Security Engineer and has a keen interest in automation and the cloud.

You can find Rick on Twitter @f3lix001