I have written and simple program in python that monitors a COM port and converts the line into a string. I then use decode to Ascii which is working fine. My problem is that I need to split the string into seperate variables.
String:
1,40.20,23.50,NOW()
I would like to split them to to seperate variables like the following example:
a = 1
b = 40.20
c = 23.50
d = NOW()
>Solution :
If you know the number of objects then you can just split on the , and assign the elements:
a, b, c, d = txt.split(',')