Integer to Binary string
Erik Max Francis
max at alcyone.com
Fri Dec 6 18:23:08 EST 2002
srijit at yahoo.com wrote:
> I would like to know the most efficient Pythonic way to convert an
> integer to a binary string. Any suggestions?
> Is there any Python function similar to _itoa?
It looks like most of the other respondants misunderstood your question
(the mention of _itoa was the key). Just use the str builtin:
>>> i = 10
>>> i
10
>>> str(i)
'10'
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ Did you ever love somebody / Did you ever really care
\__/ Cassandra Wilson
Crank Dot Net / http://www.crank.net/
Cranks, crackpots, kooks, & loons on the Net.
More information about the Python-list
mailing list