换行一体化python字符串

时间:2012-09-25 18:37:52

标签: python html django string

我有:

...
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:

但我想要打印:

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

我以为我正确使用它。如何获得成功生产我需要的换行符?

提前感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

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