[Python] how to display python console output on html page using flask

Discussão em 'Python' iniciado por Stack, Agosto 11, 2025.

  1. Stack

    Stack Membro Participativo

    def execute():
    print("this is imam")
    #perform some task after first print then print next function
    print('this akarsh')
    #perform some task after first print then print next function
    print('this is abhi')

    @app.route('/')
    def home ():
    return render_template('index.html', x= execute())


    I just wanted to print the upper three print statements on my html page i have tried with the set variable to pass, please help me with this. As it prints on python console one after the other performing certain task as mentioned.
    ​

    Continue reading...

Compartilhe esta Página