擅长:python、mysql、java
<p>您在python2上运行代码,而不是python3。在python2中,<a href="https://docs.python.org/2/library/functions.html#input" rel="nofollow noreferrer">^{<cd1>}</a>将它读取的字符串计算为Python代码(请参见<a href="https://stackoverflow.com/questions/4915361/whats-the-difference-between-raw-input-and-input-in-python3-x">this question</a>)。在</p>
<p>如果您将使用python2,请将<code>input</code>替换为<a href="https://docs.python.org/2/library/functions.html#raw_input" rel="nofollow noreferrer">^{<cd3>}</a>。在</p>
<p>如果要使用Python 3,最好将shebang更改为:</p>
<pre><code>#!/usr/bin/python3
</code></pre>