[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
- Previous message: [Python-3000] String literal representation of integers (octal/binary discussion)
- Next message: [Python-3000] [OT] Re: String literal representation of integers (octal/binary discussion)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Python-3000] String literal representation of integers (octal/binary discussion)
- Next message: [Python-3000] [OT] Re: String literal representation of integers (octal/binary discussion)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]