I'm trying to convert a string into a binary integer:
string = "0b011"
i = int(string)
But this code raises a ValueError
. However, the following code works fine:
i = int(0b011)
But here I've passed a binary literal, not a string. How do I convert a string?