integer to binary...
nicolasg at gmail.com
nicolasg at gmail.com
Thu Jun 1 15:56:23 EDT 2006
nicolasg at gmail.com wrote:
> Grant Edwards wrote:
> > On 2006-06-01, nicolasg at gmail.com <nicolasg at gmail.com> wrote:
> >
> > > does anyone know a module or something to convert numbers like integer
> > > to binary format ?
> >
> > They _are_ in binary format.
> >
> > > for example I want to convert number 7 to 0111 so I can make some
> > > bitwise operations...
> >
> > Just do it:
> >
> > >>> 7 & 3
> > 3
> > >>> 7 | 8
> > 15
> >
> >
this is exactly what I need ->
http://www.daniweb.com/code/snippet285.html
thanks.
> > --
> I know I can do that but I need to operate in every bit separeted.
> > Grant Edwards grante Yow! QUIET!! I'm being
> > at CREATIVE!! Is it GREAT
> > visi.com yet? It's s'posed to SMOKEY
> > THE BEAR...
More information about the Python-list
mailing list