The are times were you may need to print the location of a python module. There are a number of ways to achieve this. However the most simplistic method have found is to use ‘inspect’.
Below shows you an a example,
>>> import inspect
>>> import urllib2
>>>
>>> print inspect.getfile(urllib2)
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.pyc
Latest posts by Rick Donato (see all)
- How to Configure a BIND Server on Ubuntu - March 15, 2018
- What is a BGP Confederation? - March 6, 2018
- Cisco – What is BGP ORF (Outbound Route Filtering)? - March 5, 2018
Want to become a programming expert?
Here is our hand-picked selection of the best courses you can find online:
Python Zero to Hero course
Python Pro Bootcamp
Bash Scripting and Shell Programming course
Automate with Shell Scripting course
The Complete Web Development Bootcamp course
and our recommended certification practice exams:
AlphaPrep Practice Tests - Free Trial