I'd like to know where the module I'm about to import is coming from. Is there a which
command in python?
Example:
>>> which module_name
/usr/lib/python2.6/site-packages/module_name.py
import imp
imp.find_module(module_name)
Help on built-in function find_module
in module imp:find_module(...)
find_module(name, [path]) -> (file, filename, (suffix, mode, type))
Search for a module. If path is omitted or None, search for a built-in, frozen or special module and continue search in sys.path. The module name cannot contain '.'; to search for a submodule of a package, pass the submodule name and the package's__path__
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With