[Tutor] Tutor Digest, Vol 53, Issue 18

Alan Gauld alan.gauld at btinternet.com
Sun Jul 6 01:52:14 CEST 2008


"kinuthiA muchanE" <muchanek at gmail.com> wrote

>> python on Ubuntu.  How would I find the location of the modules
>> (find /  -name "os.py" does not yield results)?

Not all modules are implemented as .py files.
Some are compiled C libraries. Thus searching 
for .py will not find all Python modules. Also you may only 
have the compiled python installed although thats less likely.

You can find any module by importing it and asking 
for its file:

>>> import os
>>> os.__file__
'/usr/lib/python2.5/os.pyc'
>>>

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld



More information about the Tutor mailing list