def bin(i): s = '' while i: s = (i & 1 and '1' or '0') + s i >>= 1 return s or '0' 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? > > Thanks