help in obtaining binary equivalent of a decimal number in python

lokeshkoppaka at gmail.com lokeshkoppaka at gmail.com
Thu May 23 07:30:15 EDT 2013


i need to get 32 bit binary equivalent of a decimal and need to change the 0's to 1's and 1's to 0's
For Example
if the input is 2 
Output should be:
the 32bit equivalent of 2 :0000 0000 0000 0000 0000 0000 0000 0010
and the 1's compliment is:1111 1111 1111 1111 1111 1111 1111 1101



is there any pre-defined function to get the above results in python?? 



More information about the Python-list mailing list