little help in homework required
JAIDIP patel
jaidip.81 at gmail.com
Fri Jun 16 05:06:25 EDT 2017
I just wrote the code with Python 3.6.1, I am just a beginner in python.
while compiling having below error, can anyone help me in this
TypeError: a bytes-like object is required, not 'str'
The code I wrote:
import socket
mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
mysock.connect(('data.pr4e.org', 80))
mysock.send('GET http://data.pr4e.org/intro-short.txt HTTP/1.0\n\n')
while True:
data =x.recv(512)
if ( len(data) < 1 ) :
break
print (data)
mysock.close()
More information about the Python-list
mailing list