Python Forum

Full Version: Problem with delimiters
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone
I am quite stuck. i am trying to get a message from a TCP communication protocol, this message is converted in a list of strings and then into a list of float, The thing is that im getting an error because of the delimiters. here is my code

while True:

    message = conn.recv(BUFFER_SIZE)
    if not message:
        break
                
    t1 = time.time()
    message = message.decode("utf-8")
    print("Raw message: {}".format(message))


    data = list(message.split(","))
    print("Data Size:{} ".format(len(data)))
MyNewData = []
    for item in data:
        MyNewData.append(float(item))
    print("The new list: {}".format(MyNewData))

        
#     data = list(map(float,message.split(",")))
    print("Size:{} ".format(len(data)))
now, if you post the raw message from line 8.... we may be able to help