Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with delimiters
#1
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)))
Reply
#2
now, if you post the raw message from line 8.... we may be able to help
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Split string between two different delimiters, with exceptions DreamingInsanity 2 353 Aug-24-2020, 08:23 AM
Last Post: DreamingInsanity
  Problem with delimiters johnprada 5 670 Jan-29-2020, 10:17 AM
Last Post: DeaD_EyE
  splitting a string with 2 different delimiters Skaperen 4 725 Dec-30-2019, 04:49 AM
Last Post: BamBi25
  Split a long string into other strings with no delimiters/characters krewlaz 4 636 Nov-15-2019, 02:48 PM
Last Post: ichabod801
  re.split multiple delimiters problem gw1500se 2 1,461 Jun-24-2019, 02:43 PM
Last Post: gw1500se
  Finding nested delimiters wfsteadman 4 1,489 Jan-22-2018, 07:23 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020