DIV and MOD

Steve Holden sholden at holdenweb.com
Mon Jul 29 11:31:37 EDT 2002


"Marcus Vinicius Laranjeira" <m.laranjeira at datacraft.com.br> wrote ...
> I need to use some function like DIV (returns the integer part of a
> division) and MOD (returns the reminder of a division) in python, but I
> don't know how to do that. % does not work as expected (in this context)
> and in the MATH module, I didn't find any kind of function to do such
thing.
>

Perhaps you are looking for divmod()? No need for math modules in that case.

>>> divmod(334, 5)
(66, 4)
>>>

regards
----------------------------------------------------------------
Steve Holden                                 http://www.holdenweb.com/
Python Web Programming                http://pydish.holdenweb.com/pwp/
-----------------------------------------------------------------------








More information about the Python-list mailing list