Passing python values to HTML

Post your questions, doubts and issues related to Python Programming
no avatar
Posts: 1
Joined: Thu May 23, 2013 1:09 am

Passing python values to HTML

by subhendusc » Thu May 23, 2013 1:20 am

When i run the below program from the console , it is showing the data it receives from serial input in the console.
But , I want to display the data in the webpage , maybe in a box. How can I do it?
The python program is
import time
import cgi
from serial import Serial
import subprocess

ser = Serial('COM4', 115200, timeout=1)
print("connected to: " + ser.portstr)

while True:
# Read a line and convert it from b'xxx\r\n' to xxx
line = ser.readline().decode('utf-8')[:-2]

if line: # If it isn't a blank line
if line == '520':["xte", "key Up"])
elif line == '620':["xte", "key Down"])
elif line == '110':


The data is continuously generated as it receives from the sensor. I need to show the last available data

Return to Python Programming