擅长:python、mysql、java
<p>似乎你在输入后错过了作业的第一步</p>
<blockquote>
<p>copies the lines of text from the file into a list</p>
</blockquote>
<p>有了它,你就会</p>
<pre><code>with open(enterfile) as f:
lines = [line.rstrip() for line in f]
# continue on from here
</code></pre>
<p>现在,忘记您有一个文件,您可以使用<code>len(lines)</code>和{<cd2>}分别获得总行数和特定行数</p>