Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Print End-Of-Line character in Flask, Python

$
0
0

I'm using render_template_string() method of Flask to generate HTML code, but I can't generate the end of line character. I tried the "\n" character, but it doesn't work. That is, in the generated page (when you right-click -> look at the page code), all the generated HTML code is in one line.

PHP had a constant PHP_EOL that did the job just fine, is there something similar in Python?

The code below generates a code merged into one line.

    return render_template_string( '<p>'+ text +'</p>'+'\n') + \           render_template_string( '</details>'+'\n')

Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>