hg at nospam.org
Sat Mar 10 11:58:06 CET 2007
Dan Bishop wrote:
> On Mar 10, 11:32 am, "Jack" <nos... at invalid.com> wrote:
>> This is a naive question:
>> "%u" % -3
>> I expect it to print 3. But it still print -3.
>> Also, if I have an int, I can convert it to unsigned int in C:
>> int i = -3;
>> int ui = (unsigned int)i;
>> Is there a way to do this in Python?
> def unsigned(n):
> return n & 0xFFFFFFFF
or abs(-1) ?
More information about the Python-list