As a reference:
def toBinary(n): return ''.join(str(1 & int(n) >> i) for i in range(64)[::-1])
This function can convert a positive integer as large as 18446744073709551615
, represented as string '1111111111111111111111111111111111111111111111111111111111111111'
.
It can be modified to serve a much larger integer, though it may not be as handy as "{0:b}".format()
or bin()
.