I have a txt file in csv form but with unnecessary few lines on top. I need to skip a few 8-10 lines (it depends from file), after "[App]" line.
The file looks like this:
1, trash
2, trash
3, [APP]
4
.
.
.
100
and I need to save the 4-100 lines as csv where 4 will be headers and rest are rows.
What is the best way? I tried a: "with open"
with open('som.txt', 'r') as fin:
data = fin.read().splitlines(True)
with open('som.txt', 'w') as fout:
fout.writelines(data[7:])
print(data)
So, I have now data list and its ok, but that code skip lines after a number of lines, not specific word. Also, I can't save this list as properly CSV file; c Can u help?:)