user3893623
user3893623

Reputation: 321

python - web.py render html without using templates

import web

class index:
    def GET(self):
        i = web.input(age=None)
        return "You are " + i.age


if __name__ == "__main__":
    app = web.application(urls, globals())
    app.run()

This is my code. I'm testing something.

It isn't rendering the html. For example, If I return i.name by itself, and the age (i.age) parameter = <b>25</b>, it will show 5 as bolded and it renders it nicely. However, if I return return "You are " + age, the html will not render and it will just show as Hi <b>25</b>

Upvotes: 0

Views: 707

Answers (1)

Apoorv
Apoorv

Reputation: 393

You can use return "<html>Your are" + i.age + "</html>" as any markup entered by the user would also be considered.

Upvotes: 1

Related Questions