'Python - Getting output of socket
I am trying to get the output after the lolimessage was sent but i get no output
try:
xmr = ''
data = s.recv(1024)
d = data.decode("UTF-8")
xmr += d
if "loli" in xmr:
s.send(lolimessage + enter)
print("Loli Sent")
else:
print("loli NOT sent")
except:
s.close()
try:
xmr = ''
data = s.recv(1024)
d = data.decode("UTF-8")
xmr += d
print(xmr)
except:
print("fail to print")
s.close()
The loli part works and prints out data but on the 2nd try i get "fail to print", can any1 plz help
Solution 1:[1]
s.send(lolimessage + enter)
send it in bytes with encoding
s.send(bytes(lolimessage + enter, "utf-8"))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Shashankh_ |

