I have an Arduino connected to my computer running a loop, sending a value over the serial port back to the computer every 100 ms.
I want to make a Python scr
You can use ser.flushInput() to flush out all serial data that is currently in the buffer.
After clearing out the old data, you can user ser.readline() to get the most recent data from the serial device.
I think its a bit simpler than the other proposed solutions on here. Worked for me, hope it's suitable for you.