[Tutor] How to test for a remainder from division

Terry Carroll carroll at tjc.com
Wed May 16 01:30:19 CEST 2007


On Tue, 15 May 2007, Kent Johnson wrote:

> Matt Smith wrote:
> > 
> > Thanks for the help. For future reference how do I go look at the
> > implementation of a particular function (the ones coded in Python, I
> > don't know C)?
> 
> Look in the lib directory that was installed with Python. The location 
> varies. On Windows look for C:\Python2.x\Lib. My Mac has it at
> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5
> 
> In the python interpreter, try
>  >>> import sys
>  >>> sys.path
> 
> The lib directory will be listed as one element of sys.path.

Will the following approach always work?  It's what I start with.

>>> import calendar
>>> print calendar.__file__
C:\Python25\lib\calendar.py




More information about the Tutor mailing list