Back
Are there any canned Python methods to convert an Integer (or Long) into a binary string in Python?
There is a myriad of dec2bin() functions out on Google... But I was hoping I could use a built-in function/library.
Python's string format method can take a format spec.
>>> "{0:b}".format(37) '100101'
>>> "{0:b}".format(37)
'100101'
30.9k questions
32.9k answers
500 comments
665 users