擅长:python、mysql、java
<p>您的选择排序似乎正确,但前面的部分有问题:</p>
<p>(如果不忽略我的答案,我假设这是python2.X)</p>
<ul>
<li><a href="https://stackoverflow.com/questions/3800846/differences-between-input-and-raw-input">You need to use ^{<cd1>} not ^{<cd2>}.</a></li>
<li><a href="https://stackoverflow.com/questions/15233340/getting-rid-of-n-when-using-readlines">^{<cd3>} doesn't get rid of the ^{<cd4>} at the end of every line. You need to strip it away.</a></li>
</ul>
<p>更正代码:</p>
<pre><code>filename=raw_input('Enter file path:')
file = open(filename, 'r')
alist = [int(line.strip()) for line in file.readlines()]
print(alist)
</code></pre>