擅长:python、mysql、java
<p>您可以传递额外的值而不使用它们,就像这个轻量级选项一样</p>
<pre><code>printme = random.choice(["On {date}, {user} did la-dee-dah. ",
"{User} did la-dee-dah on {date}. "
])
output = printme.format(user=x, date=y, User=x.capitalize())
</code></pre>
<p>最好的选择可能取决于你是否做得足够,需要你自己的全面<code>Formatter</code>。</p>