how do I convert Convert 32 bit binary to a decimal in python
this
00011110001101110110110000001000
to
506948616
this
use in-built function int():
a = '00011110001101110110110000001000'
a_dec = int(a, 2)
1. You need additional work for that.use int for conversion of a string (just give the correct base as parameter):
int('00011110001101110110110000001000', 2)
Another way is to add 0b as a prefix for the number (same as 0x for hex values or 0o for octal values):
x=0b00011110001101110110110000001000
x will be an integer with decimal value of 506948616