<p>我有一个文件,我需要分裂成更小的文件,具体行索引号码。你知道吗</p>
<p>我准备了索引-行标题中的行是:</p>
<pre><code>listOfHeadersIndex = []
with open('Poland.csv', 'r') as csvfile:
for i, line in enumerate(csvfile):
if '[Header]' in line:
print(i)
listOfHeadersIndex.append(i)
</code></pre>
<p>以及:</p>
<pre><code>listOFHeadersIndex is for example = 0,33,46,74.
</code></pre>
<p>现在我要把它分开。第一个文件应该包含0-32行,第二个33-45行,等等。我只找到了如何按常量行拆分的建议。如何以一种简单的方式在python中完成它?你知道吗</p>