**当我输入" dir"在控制台中我收到此错误,错误显示此行" client_response = str(conn.recv(1024)," utf-8")" **
def socket_accept():
conn, address = s.accept()
print("Connection has been established | " + "IP " + address[0] + "| Port " + str(address[1]))
send_commands(conn)
conn.close()
def send_commands(conn):
while True:
cmd = input()
if cmd == 'quit':
conn.close()
s.close()
sys.exit()
if len(str.encode(cmd)) > 0:
conn.send(str.encode(cmd))
client_response = str(conn.recv(1024), "utf-8")
print(client_response, end ="")
答案 0 :(得分:0)
请参考以下链接-表示将python升级到3.7.3或更高版本: