I have a Text file as below:
Education: askdjbnakjfbuisbrkjsbvxcnbvfiuregifuksbkvjb.iasgiufdsegiyvskjdfbsldfgdTechnical skills : java,j2ee etc.,work done: oaugafiuadgkfjwgeuyrfvskjdfviysdvfhsdf,aviysdvwuyevfahjvshgcsvdfs,bvisdhvfhjsvjdfvshjdvhfjvxjhfvhjsdbvfkjsbdkfg
I would like to extract only the heading names such as Education,Technical Skills etc.
the code is :
with open("aks.txt") as infile, open("fffm",'w') as outfile:copy = Falsefor line in infile:if line.strip() == "Technical Skills":copy =Trueelif line.strip() == "Workdone":copy = Trueelif line.strip() == "Education":copy = Falseelif copy:outfile.write(line)fh = open("fffm.txt", 'r')contents = fh.read()len(contents)