[Python-3000] String literal representation of integers (octal/binary discussion) (original) (raw)

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Mar 20 01:16:33 CET 2007


Bob Ippolito wrote:

It would absolutely help if there was an obvious way to get a string of 1s and 0s out of an integer given the number of bits you want to write it as

The obvious thing would be

"%bm.n" % i

where n = maximum number of bits.

-- Greg



More information about the Python-3000 mailing list