擅长:python、mysql、java
<p>因此,这应该是你想要的-虽然听起来像是我不会使用python的东西,而是一些bash命令。。。你知道吗</p>
<pre><code>with open('file.txt','r') as f: #open your file to read it
file = f.readlines() #save lines of the file as list
with open('newfile.txt','w') as f: #open (create) an output file
f.write(file[1:7]) #write the 2nd to 7th list elements in there (0-incremented)
</code></pre>