擅长:python、mysql、java
<p>是的,把你的文件读到一个列表里</p>
<pre><code>myfile_list = open(file).readlines()
newList = []
for line in myfile_list:
.
.
newList.append(line) # this is the line after you have made your changes
outref = open(myfile,'w')
outref.writelines(newList)
outref.close()
</code></pre>