[Tutor] div_t
Kent Johnson
kent37 at tds.net
Thu Jan 12 02:06:31 CET 2006
Burge Kurt wrote:
> Hi,
>
> What is the usage of div_t in python?
>
> I have some unsigned integer variables and want to use ;
>
> div_t div_T;
> div_t div_N;
> div_t div_B;
I guess this is more C code. It doesn't have any Python equivalent -
Python doesn't declare variables and doesn't have unsigned integers.
You might be interested in the divmod() function:
>>> help(divmod)
Help on built-in function divmod in module __builtin__:
divmod(...)
divmod(x, y) -> (div, mod)
Return the tuple ((x-x%y)/y, x%y). Invariant: div*y + mod == x.
>>> divmod(10, 3)
(3, 1)
You will in general get a better response from this list if you tell us
what problem you are trying to solve, rather than showing brief snippets
of C. Even better is to attempt a solution in Python and let us see
where you get stuck. Have you read any of the tutorials I pointed out?
Programming Python is quite different from C and you should try to get
the flavor of it.
Kent
More information about the Tutor
mailing list