擅长:python、mysql、java
<p>在Python 3.x中,<code>raw_input</code>被重命名为<code>input</code>,Python 2.x<code>input</code>被删除。</p>
<p>这意味着,就像Python 3.x中的<code>raw_input</code>,<a href="http://docs.python.org/3/library/functions.html#input" rel="nofollow noreferrer">^{<cd2>}</a>总是返回一个字符串对象。</p>
<p>要解决此问题,需要通过将这些输入放入<a href="http://docs.python.org/3/library/functions.html#int" rel="nofollow noreferrer">^{<cd6>}</a>来显式地将它们转换为整数:</p>
<pre><code>x = int(input("Enter a number: "))
y = int(input("Enter a number: "))
</code></pre>