首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Newline all-in-one python字符串

Newline all-in-one python字符串
EN

Stack Overflow用户
提问于 2012-09-26 02:37:52
回答 1查看 96关注 0票数 0

我有:

代码语言:javascript
复制
...
post_str = "Please input the following information... \nDescription: \n Last Name:"
context = {
     'post_str':post_str,
      ...
}
return render_to_response('contact/contact.html', context, context_instance=RequestContext(request))

它是这样打印的,

Please input the following information... Description: Last Name:

但我想把它打印出来:

代码语言:javascript
复制
Please input the following information...
Description:
Last Name:

我以为我用对了。如何让换行符成功地生成我需要的内容?

提前感谢您的帮助。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-09-26 02:52:37

换行符在HTML中不做任何事情。请改用<br />

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12589094

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档