integer to binary...

Bruno Desthuilliers bdesth.quelquechose at
Sat Jun 3 01:56:03 CEST 2006

Grant Edwards a écrit :
> On 2006-06-01, nicolasg at <nicolasg at> wrote:
>>does anyone know a module or something to convert numbers like integer
>>to binary format ?
> They _are_ in binary format.

Not really.

>>> (7).__class__
<type 'int'>
>>> dir((7))
['__abs__', '__add__', '__and__', '__class__', '__cmp__', '__coerce__',
'__delattr__', '__div__', '__divmod__', '__doc__', '__float__',
'__floordiv__', '__getattribute__', '__getnewargs__', '__hash__',
'__hex__', '__init__', '__int__', '__invert__', '__long__',
'__lshift__', '__mod__', '__mul__', '__neg__', '__new__', '__nonzero__',
'__oct__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__',
'__rdiv__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__',
'__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__',
'__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__',
'__rxor__', '__setattr__', '__str__', '__sub__', '__truediv__', '__xor__']

More information about the Python-list mailing list