Jan-28-2020, 03:59 PM
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
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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))) |