little help in homework required
Lutz Horn
lutz.horn at posteo.de
Fri Jun 16 05:39:55 EDT 2017
Hi,
> TypeError: a bytes-like object is required, not 'str'
...
> mysock.send('GET http://data.pr4e.org/intro-short.txt HTTP/1.0\n\n')
Here you must encode the str as bytes:
mysock.send('GET http://data.pr4e.org/intro-short.txt
HTTP/1.0\n\n'.encode("UTF-8"))
The actual encoding does not matter in your case since you only have
ASCII.
> data =x.recv(512)
This gives the next error:
NameError: name 'x' is not defined
What is x supposed to be?
Regards
Lutz
More information about the Python-list
mailing list