Answers for "how to put python in html"

2

how to connect python to html

data = [1, 2, 3, 4]


def data_to_html_table(data):
    html = '<table><tbody>'
    for item in data:
        html += '<tr><td>' + str(item) + '</td></tr>'
    html += '</tbody></table>'
    return html

print data_to_html_table(data)

#credit to stackoverflow.com
Posted by: Guest on October-08-2020
1

html in python

from flask import Flask
app=Flask('app')
@app.route('/')
def run_code():
    return '<!-- Reference external html file here... -->'
app.run(host='0.0.0.0', port=8080)
Posted by: Guest on July-06-2020

Python Answers by Framework

Browse Popular Code Answers by Language