Access Temperature sensor data of 3D printer via Serial connection
Assuming your printer accepts conventional G-code flavor, extruder and bed temperature can be retrieved by sending M105 through the serial port. The printer will respond with ok T:XXX.X B:XXX.X where T is the nozzle temperature and B is the bed temperature.

You can read more about the specific G-code in the RepRap wiki.

EDIT:
I am editing the answer to include information for connecting to the printer using a simple python script.

The following script, first opens a serial connection to the printer. For Marlin firmware, when you first connect to the printer, it needs some time to initialize and respond back. That is why some delay is needed before reading the response. After printing the response, the script sends the M105 command, waits for 100ms, then reads the response of the serial buffer and prints it on the screen. 

Note /dev/ttyUSB0 is the serial port name and in your case it may be different. Also 250000 is the baud rate of the connection; 250000 is the default value of my printer so you need to replace this with the baud rate that your printer uses.

import serial
import time

ser_printer = serial.Serial('/dev/ttyUSB0', 250000)
print "Connecting to printer..."
time.sleep(30)  # Allow time for response
buffer_bytes = ser_printer.inWaiting()
response = ser_printer.read(buffer_bytes)  # Read data in the buffer
print "Connection response from printer:"
print response
print "Asking for temperatures (M105)..."
ser_printer.write('M105\n')
time.sleep(0.1)  # Allow time for response
print "Temperature response from printer:"
response = ser_printer.readline()
print response