试图通过pep8重新分解代码。Python:多行格式输出空间
代码:
print """Exception when sending email to: {0},
from: {1}, subject: {2}, e: {3}""".format(to, fr, subject, e)
输出:
Exception when sending email to: to,
from: fr, subject: subject, e: Invalid URL 'http//127.0.0.1:8000/'
如何在上面的输出from
之前删除的空间?由于
UPDATE
工作正常,以下代码。我应该删除这篇文章吗?
34 print ($
35 "Exception when sending email to: {0},"$
36 "from: {1}, subject: {2}, e: {3}").format(to, fr, subject, e)$
字符串文字不需要在中间缩进。 –