I receive data from a socket in Python 3 with
data = ""
...
data = s.recv(1024)
When I want to print(data) and print (type(data)), it tells me:
b'contentofdata'
<class 'bytes'>
How can I convert data back to a string so it only shows contentofdata after print(data)? I tried a lot with .decode or .encode, but it does not seem to work in Python 3.
data.decode().