擅长:python、mysql、java
<p>您可以创建自己的<a href="http://docs.python.org/2/library/string.html#string-formatting">^{<cd1>}</a>子类,该子类将允许您识别自定义的<a href="http://docs.python.org/2/library/string.html#formatstrings">conversion</a>,您可以使用该自定义的<a href="http://docs.python.org/2/library/string.html#formatstrings">conversion</a>来重新设置字符串。</p>
<pre><code>myformatter.format('{user!u} did la-dee-dah on {date}, and {pronoun!l} liked it. ',
user=x, date=y, pronoun=z)
</code></pre>