我该如何解析类似字节的对象,而不是str?

时间:2020-03-22 09:03:37

标签: python sockets error-handling

导入套接字

target_host =“ www.google.com” target_port = 80

client = socket.socket(socket.AF_INET,socket.SOCK_STREAM)

client.connect((target_host,target_port))

client.send(“ GET / HTTP / 1.1 \ r \ n主机:google.com \ r \ n \ r \ n”)

响应= client.recv(4096)

打印(响应)

我得到一个错误:对于“ client.send ...”行,不需要像字节这样的对象str

0 个答案:

没有答案