擅长:python、mysql、java
<p>你已经非常接近了,你已经有了正确的模板,现在你必须告诉它<code>{name}</code>应该被什么替换:</p>
<pre><code>>>> example = "Foo"
>>> "Hello, {name}!".format(name=example)
'Hello, Foo!'
</code></pre>
<p>有关使用<a href="https://docs.python.org/2/library/stdtypes.html#str.format" rel="nofollow">^{<cd2>}</a>的详细信息,请参见<a href="https://docs.python.org/2/library/string.html#formatstrings" rel="nofollow">the docs</a>。你知道吗</p>