You can use hex
, oct
, bin
and int
functions:
In [8]: hex(18446738026812173208L)
Out[8]: '0xfffffa8018d46b98L'
In [9]: oct(18446738026812173208L)
Out[9]: '01777777650003065065630L'
In [10]: bin(18446738026812173208L)
Out[10]: '0b1111111111111111111110101000000000011000110101000110101110011000'
In [11]: int(bin(18446738026812173208L), 2)
Out[11]: 18446738026812173208L
In [12]: int(oct(18446738026812173208)[:-1], 8)
Out[12]: 18446738026812173208L
In [13]: int(hex(18446738026812173208)[:-1], 16)
Out[13]: 18446738026812173208L
The slicing is required as all three functions return a string and both oct
and hex
append L
.