擅长:python、mysql、java
<p>当然可以:</p>
<pre><code>with open("filename", 'r') as file:
current_line = next(file) # Get 1st line, advance iterator to 2nd line
for next_line in file:
do_something(current_line, next_line)
current_line = next_line
</code></pre>