At Thursday 28/9/2006 05:22, Mirco Wahab wrote:
> String formatting can be used to converting an integer to its octal or
> hexadecimal form:
> >>> a = 199
> >>> "%o" % a
> '307'
> >>> "%x" % a
> 'c7'
>
> But, can string formatting be used to convert an integer to its binary
> form ?
a = 199
a_bin_str = pack('L', a)
Notice that the OP was looking for another thing, given the examples.
Perhaps a better wording would have been "how to convert an integer
to its base-2 string representation".
Gabriel Genellina
Softlab SRL
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas
--
http://mail.python.org/mailman/listinfo/python-list