This program is supposed to receive a chain from a host server (this script works perfectly). This string was a list in the host script, but I used a string (list) to turn it into a string.
The channel that I send is: [‘a’, ‘b’, ‘c’, ‘d’, ‘e’]. The code is as follows:
since the socket import * from the import * s = socket () port = 5000 s.connect ((-LAPTOP-B9U2O9K6, port)) in truth: message = s.recv (1024) .decode () if message == # q; s.close () elif message! = & # 39; q & # 39 ;: message = literal_eval (message) message = [n.strip() for n in message] print (message)
The output is:
['a', 'b', 'c', 'd', 'e'] File "
"line 0 ^ SyntaxError: Unexpected EOF during the scan
Can any one tell me how to solve this problem !? I do not know how!