简体   繁体   中英

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>

您可以使用return "<html>Your are" + i.age + "</html>"因为也会考虑用户输入的任何标记。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM