Issue
I was playing around with flask when I came across an odd problem with the '\n' character. it dosen't seem to have an effect in my browser, I tried putting
in there but it didn't work, any ideas?
from flask import Flask
from flask import render_template
test=Flask(__name__)
@test.route('/')
def root():
str='yay\nsuper'
return str
test.run(debug=True)
Solution
Newlines only have an effect on HTML rendering in specific cases. You would need to use an HTML tag representing a newline, such as <br/>
.
def root():
str='yay<br/>super'
return str
Answered By - David Robinson
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.