unsigned integer?

Jack nospam at invalid.com
Sat Mar 10 20:17:42 CET 2007


Thanks for all the replies. Because I want to convert an int,
Dan's function actually does it well.

"Jack" <nospam at invalid.com> wrote in message 
news:I9Kdndp49PJLdm_YnZ2dnUVZ_t-mnZ2d at comcast.com...
> 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?
> 





More information about the Python-list mailing list