binario a decimal en pitón
int(binaryString, 2)
Bored Bison
int(binaryString, 2)
==== Convert binary to decimal in Python ======
a = '11001100' # input a binary
b = int(a,2) # base 2 to base 10
print(b,type(b)) # 204 <class 'int'>
>>> int('11111111', 2)
255
def binary2int(binary):
int_val, i, n = 0, 0, 0
while(binary != 0):
a = binary % 10
int_val = int_val + a * pow(2, i)
binary = binary//10
i += 1
print(int_val)
binary2int(101)
format(decimal ,"b")
# Convert integer to binary
>>> bin(3)
'0b11'
# Convert binary to integer
>>> int(0b11)
3