0
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>

6
  • how about return "<body> You are " + i.age + "</body>" ? Commented Aug 26, 2014 at 14:37
  • It works, but I'd like the html to be controlled by user input Commented Aug 26, 2014 at 14:39
  • like what? do you want the input to be of format <tag>age</tag> ? Commented Aug 26, 2014 at 14:42
  • yes, thats what i want. Commented Aug 26, 2014 at 14:43
  • in that case, the above solution should still work Commented Aug 26, 2014 at 14:44

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.