0

I don't know much about Python, so sorry if this sounds silly. I am getting a string of 0s and 1s from an Arduino, and I need to convert it to a 'regular' number. I've found out how to convert a binary string to a decimal integer pretty easily, but how would I convert it if my binary string is stored in a variable ?

Let's say I've got a=00000110

int(a, 2) doesn't work (tells me "int() can't convert non-string with explicit base")

Is there a specific syntax that I should be aware of ? Can't I put a variable in here ?

Thanks in advance !

Kronope
  • 21
  • 7

0 Answers0