import serial import time ser = serial.Serial('/dev/ttyAMA0', 38400) try: while 1: # print('* ', time.strftime('%Y/%m/%d %H:%M:%S')) response = ser.readline() z = response.split(" ") print z if len(z)>=7: print "Power 1: %s Watts" % z[0] print "Power 2: %s Watts" % z[1] print "Power 3: %s Watts" % z[2] print "Power 4: %s Watts" % z[3] print "Power 5: %s Watts" % z[4] print "Power 6: %s Watts" % z[5] print "Power 7: %s Watts" % z[6] print "Power 8: %s Watts" % z[7] print "Power 9: %s Watts" % z[8] print "Power 10: %s Watts" % z[9] print "Power 11: %s Watts" % z[10] print "Power 12: %s Watts" % z[11][:-2] except KeyboardInterrupt: ser.close()