Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python翻译器_Python - Fatal编程技术网

Python翻译器

Python翻译器,python,Python,正在尝试创建客户端-服务器端应用程序,其中服务器接收输入消息并对其进行翻译 import socket portNum=6000 serverSocket=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) serverSocket.bind((socket.gethostname(),portNum)) print("The server is ready to be used") def translator(message): sta

正在尝试创建客户端-服务器端应用程序,其中服务器接收输入消息并对其进行翻译

import socket
portNum=6000
serverSocket=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
serverSocket.bind((socket.gethostname(),portNum))
print("The server is ready to be used")


def translator(message):
    starting = message[0]

    if starting == ("a" or "e" or "i" or "u"):
        newMessage = message + start + ay
        return newMessage
    else:
        message = message[1:] + starting + "ay"
        return message


while True:
    message,clientAddress=serverSocket.recvfrom(4096)
    newMessage= message.decode()
    translator(message)
    serverSocket.sendto(newMessage.encode(),clientAddress)

从不将转换器的输出分配给变量。试着换线

translator(message)


从不将转换器的输出分配给变量。试着换线

translator(message)


你犯了什么错误?你犯了什么错误?