Django Book 翻译
菜单>:
TOC
返回
原文:
If youre new to Python, you may wonder why this output includes newline characters (``'\n'`` ) rather than displaying the line breaks. Thats happening because of a subtlety in the Python interactive interpreter: the call to ``t.render(c)`` returns a string, and by default the interactive interpreter displays the *representation* of the string, rather than the printed value of the string. If you want to see the string with line breaks displayed as true line breaks rather than ``'\n'`` characters, use the ``print`` statement: ``print t.render(c)`` .
翻译:
如果你是Python初学者,你可能在想为什么输出里有回车换行的字符(``'\n'`` )而不是 显示回车换行?因为这是Python交互解释器的缘故:调用 ``t.render(c)`` 返回字符串, 解释器缺省显示这些字符串的 *真实内容呈现* ,而不是打印这个变量的值。 要显示换行而不是 ``'\n'`` ,使用 ``print`` 语句: ``print t.render(c)`` 。
备注:
译者: