【发布时间】:2019-12-21 01:08:19
【问题描述】:
我正在 VSCode 中编写一个简单的 django 视图,我想在多行中编写我的 HttpRespose,但它不起作用?怎么了?
转义码都不起作用!
def index(request):
return HttpResponse("firstline. \nanother line!!!!")
我期望输出
firstline.
another line!!!
但它的输出是
firstline. another line
【问题讨论】:
-
使用
。return HttpResponse("firstline. <br/>another line!!!!"). -
好吧,
\n实际上确实呈现了一个新行。但是浏览器只是忽略了这一点。但是,如果您返回“原始文本”流等,则会显示新行。
标签: python django vscode-debugger