Python Forum
Problem with delimiters - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/Forum-Python-Coding)
+--- Forum: General Coding Help (https://python-forum.io/Forum-General-Coding-Help)
+--- Thread: Problem with delimiters (/Thread-Problem-with-delimiters)



Problem with delimiters - johnprada - Jan-28-2020

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)))



RE: Problem with delimiters - buran - Jan-28-2020

now, if you post the raw message from line 8.... we may be able to help