connectionSocket.send("%s\r\n%s\r\n\r\n" %(first_header.encode(encoding='utf_8'), following_header.encode(encoding='utf_8')))
1 个解决方案
#1
2
You are still sending a str
string object, because you used a string template (interpolating b'...'
byte literal syntax into it).
您仍然在发送一个str字符串对象,因为您使用了一个字符串模板(插入b'…它的字节字面语法)。
Encode the result of the str % (params)
operation instead:
将str % (params)操作的结果编码:
data = "%s\r\n%s\r\n\r\n" % (first_header, following_header)
connectionSocket.send(data.encode(encoding='utf_8'))
#1
2
You are still sending a str
string object, because you used a string template (interpolating b'...'
byte literal syntax into it).
您仍然在发送一个str字符串对象,因为您使用了一个字符串模板(插入b'…它的字节字面语法)。
Encode the result of the str % (params)
operation instead:
将str % (params)操作的结果编码:
data = "%s\r\n%s\r\n\r\n" % (first_header, following_header)
connectionSocket.send(data.encode(encoding='utf_8'))