擅长:python、mysql、java
<p>问题似乎出在这一行:</p>
<pre><code>topPos = someClass.get_element_pos('element')
</code></pre>
<p>这很可能是将字符串赋给<code>topPos</code>,而不是数值变量。您需要将这个字符串转换成一个数值变量,这样您就可以对它进行数值比较。你知道吗</p>
<pre><code>topPos = int(someClass.get_element_pos('element'))
</code></pre>
<p>在任何实现中,{yth}总是小于cd2.7。你知道吗</p>
<h3>相关问题</h3>
<ul>
<li><a href="https://stackoverflow.com/questions/3270680/how-does-python-compare-string-and-int">How does Python compare string and int?</a></li>
</ul>