Read Arduino data through serial On Python

I am currently doing a project about get e-health sensor data from arduino and send the data to Raspberry Pi in wireless connection(xbee). It used the serial for transmitting data.

Now, the problem is, how do I separate the data? As I have multiple data(eg: Oxygen Saturation, Bpm), but every time I can only read the data at the same time.

This is part of the arduino code for getting sensor data:

Serial.print("PRbpm : ");
Serial.print(eHealth.getBPM());

Serial.print(" %SPo2 : ");
Serial.print(eHealth.getOxygenSaturation());

This is the python code:

import serial
ser=serial.Serial(‘dev/ttyAMA0’,9600)
while 1:
print ser.readline()

Where should I change if I want to get the data separately?

I'm not into Python but like with any decent language I assume it has some string matching/parsing libraries, so if your line begins with "PRpbm: " then the remaining line is an ascii string of a bpm value

Have a look at the parse example in Serial Input Basics. The general approach can also be implemented in Python.

This Python - Arduino demo may be useful. Note that it was written before the Serial basics.

...R