Convert base-2 binary number string to int
python
Solution
You use the built-in `int()` function, and pass it the base of the input number, i.e. `2` for a binary number:
>>> int('11111111', 2)
255
Here is documentation for Python 2, and for Python 3.
Problem
I'd simply like to convert a base-2 binary number string into an int, something like this: ``` >>> '11111111'.fromBinaryToInt() 255 ``` Is there a way to do this in Python?