0

I have a file that contains this binary strings:

00100
11110
10110
10111

How do I convert all the lines to integers?

The out put I would want for example is:

4
30
23
22
collinsmarra
  • 148
  • 1
  • 7

1 Answers1

1
int('00100', 2)
int('11110', 2)
int('10110', 2)
int('10111', 2)

See Also : Convert base-2 binary number string to int

  • Welcome to StackOverflow! It's consider best not to answer questions that are known to be duplicates. Doing so can attract downvotes. See [How should duplicate questions be handled?](https://meta.stackexchange.com/q/10841/478746) from the Meta FAQ for further details and rational. – Brian61354270 Dec 17 '21 at 04:05