擅长:python、mysql、java
<p>通过传递一个函数而不是一个提示用户的字符串来调用<code>input</code>。也许你的意思是:</p>
<pre><code>days = getAnswer()
</code></pre>
<p>将<code>getAnswer()</code>定义为使用<code>input</code>从用户那里获取响应,验证它,然后返回它。例如</p>
^{pr2}$
<p>在我看来,这比将输入函数传递给<code>getAnswer()</code>要清楚得多,<code>try...except</code>子句是一种常见且易于理解的Python习惯用法。在</p>