0

I'm trying to convert a byte like b'2076' into an integer int = 2076 but I don't know how to solve the problem. I am using python 3.7.0.

I tried to search other answers but don't find the problem I have

b'1027'

int = 1027

I expect to convert b'1027' into 1027 as a integer

Karl Knechtel
  • 62,466
  • 11
  • 102
  • 153
  • 5
    Did `int(b'2076')` not work for you? – blhsing Apr 24 '19 at 16:25
  • 3
    Possible duplicate of [How to convert strings into integers in Python?](https://stackoverflow.com/questions/642154/how-to-convert-strings-into-integers-in-python) – DYZ Apr 24 '19 at 16:53
  • blhsing thank you very much. I didn’t try int(b’2076’) before. – Bananamaths Apr 26 '19 at 16:02
  • Does this answer your question? [How do I parse a string to a float or int?](https://stackoverflow.com/questions/379906/how-do-i-parse-a-string-to-a-float-or-int) – Karl Knechtel May 19 '23 at 00:01

0 Answers0