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


Messages In This Thread
Problem with delimiters - by johnprada - Jan-28-2020, 03:59 PM
RE: Problem with delimiters - by buran - Jan-28-2020, 04:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Delimiters - How to skip some html tags from being translate Melcu54 0 297 May-26-2021, 06:21 AM
Last Post: Melcu54
  Parse String between 2 Delimiters and add as single list items lastyle 5 614 Apr-11-2021, 11:03 PM
Last Post: lastyle
  Split string between two different delimiters, with exceptions DreamingInsanity 2 658 Aug-24-2020, 08:23 AM
Last Post: DreamingInsanity
  Problem with delimiters johnprada 5 1,039 Jan-29-2020, 10:17 AM
Last Post: DeaD_EyE
  splitting a string with 2 different delimiters Skaperen 4 1,013 Dec-30-2019, 04:49 AM
Last Post: BamBi25
  Split a long string into other strings with no delimiters/characters krewlaz 4 978 Nov-15-2019, 02:48 PM
Last Post: ichabod801
  re.split multiple delimiters problem gw1500se 2 1,908 Jun-24-2019, 02:43 PM
Last Post: gw1500se
  Finding nested delimiters wfsteadman 4 1,732 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