擅长:python、mysql、java
<p>一种方法是当代码看到“lead”时“关闭”输出,当代码看到“to the Editor:”时将其重新打开</p>
<pre><code>lead = False
for line in file_to_use:
if re.search ("LEAD", line):
lead = True
if re.search ("To the Editor:", line):
lead = False
if lead == False:
print line
</code></pre>