Home  >  Article  >  Web Front-end  >  tornado如何将render中的字符串中的换行保留到html页面中显示_html/css_WEB-ITnose

tornado如何将render中的字符串中的换行保留到html页面中显示_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:48:561829browse

例如:
message = "hi
                      你好!"#(包含换行)
 self.render("logentry.html", content=message)

可是logentry.html并没有显示换行,进行如下处理:
message = "hi
                      你好!"#(包含换行)
message.replace('\n', '
')
 self.render("logentry.html", content=message)
不但没有实现,反而将
作为内容显示了

请高手指点,谢谢


回复讨论(解决方案)

使用防转意即可 http://www.qttc.net/201305320.html

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn