I am reading in a byte array/list from socket. I want Python to treat the first byte as an \"unsigned 8 bit integer\". How is it possible to get its integer value as an un
bytes/bytearray is a sequence of integers. If you just access an element by its index you'll have an integer:
>>> b'abc' b'abc' >>> _[0] 97
By their very definition, bytes and bytearrays contain integers in the range(0, 256). So they're "unsigned 8-bit integers".
range(0, 256)