有时候想知道import的模块的文件路径,看看脚本,可以通过以下方式来查看:
Python 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import identmodule
>>> print identmodule.__file__
/usr/lib/python2.6/site-packages/identmodule/__init__.pyc
通过模块的__file__属性来确定,这时候进入/usr/lib/python2.6/site-packages/identmodule/ 目录就可以查看脚本了