Home > Enterprise >  Flask app return string doesn't display <abc>
Flask app return string doesn't display <abc>

Time:03-31

I tried to display a string on a webpage with this Flask code:

@app.route('/')
def index():
    return 'Variable can be of different types: string and <int>'

and got

Variable can be of different types: string and

without "<>". A way to fix it is to add a space between "<" and "int" like:

Variable can be of different types: string and < int >. 

Also I noticed that the space for the closing > as in "< int>" doesn't matter.

Other characters such as [int] and {int} have no such a problem. Why? tag related?

CodePudding user response:

Yes, it is tags related, it gonna be shows up like this

enter image description here

If you use the less than (<) or greater than (>) signs in your text, the browser might mix them with tags.

However, if you want to still display that, you can just do this enter image description here

For more reference, here

  • Related