擅长:python、mysql、java
<pre><code>try:
with open('sample.txt', 'r') as fileObject:
fileData = fileObject.read().split("\n")
fileDataClean = [data.strip() for data in fileData]
startIndex, stopIndex = fileDataClean.index('( "head"'), fileDataClean.index('( "arraydat"')
resultData = "\n"join(fileData[startIndex:stopIndex])
print(resultData)
except Exception as e:
print(e)
</code></pre>
<p>我希望这有帮助。</em></strong></p>