【发布时间】:2017-09-14 20:07:45
【问题描述】:
尝试通过 pep8 重构代码。
代码:
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 之前的空格?谢谢
更新
以下代码工作正常。我应该删除这篇文章吗?
34 print ($
35 "Exception when sending email to: {0},"$
36 "from: {1}, subject: {2}, e: {3}").format(to, fr, subject, e)$
【问题讨论】:
-
字符串字面量不需要在中间缩进。