firstly, I would like to thanks to whomever would help me.
- Environment
I am using Python v2.7 in Windows 8 OS. I am using COM4 to talk to robot by sending some commands in Python code.
I send a command getversion to robot and suppose to get a bunch of data which is in the following format (I omit some, it is too long):
Component,Major,Minor,Build,Aux
APPassword,956FC721
BaseID,1.2,1.0,18000,2000,
BatteryType,4,LIION_4CELL_SMART,
Beehive URL, beehive.cloud.com
BlowerType,1,BLOWER_ORIG,
Bootloader Version,27828,,
BrushMotorType,1,BRUSH_MOTOR_ORIG,
BrushSpeed,1400,,
BrushSpeedEco,800,,
ChassisRev,1,,
Cloud Selector, 2
DropSensorType,1,DROP_SENSOR_ORIG,
LCD Panel,137,240,124,
LDS CPU,F2802x/c001,,
LDS Serial,KSH13315AA-0000153,,
- My Question Is: Based on this format, how to get the size (in byte) of the above result? The reason for this question is, I can get the full/complete result as long as I know how large it is.
To be specific, my code is:
ser.write('getver \n') # send 'getversion' cmd to robot
ser.read(1305)
The response size of getver is 1305 byte, yes, I count it manually, that is why I would like to ask Python to tell me how large it is automatically.
data=ser.read()thensize=len(data)ser.readlines()?