I receive a row of bytes over a socket connection as data. When I print(data)
it tells me
b'123'
How can I convert it back to a string and only print 123
? If I do type(data)
it puts out
<class 'bytes'>
When I do data.decode("utf-8") it puts me out 'bytes' object has no attribute 'decode'. Do I mix something up with the type?
Thanks