[EMAIL PROTECTED] wrote:

> does anyone know a module or something to convert numbers like integer
> to binary format ?
> 
> for example I want to convert number 7 to 0111 so I can make some
> bitwise operations...

  >>> def bits(i,n):
         return tuple((0,1)[i>>j & 1] for j in xrange(n-1,-1,-1))

  >>> bits(7,4)
  (0, 1, 1, 1)

Anton
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to