擅长:python、mysql、java
<p>作为另一种更优雅的方法,您可以将字符串放在列表中,并使用escape将它们连接起来<code>\n</code>和add<code>\</code>到前导:</p>
<pre><code>>>> l=['method', 'canonical_uri', 'canonical_querystring', 'canonical_headers']
>>> print '\\n'.join(l)
method\ncanonical_uri\ncanonical_querystring\ncanonical_headers
</code></pre>
<blockquote>
<p>The backslash (\) character is used to escape characters that otherwise have a special meaning, such as newline, backslash itself, or the quote character.</p>
</blockquote>