I have couple of Text files which have text in following format
Technical :
localization lengths is observed at particular energies for an increasing binary backbone disorder. We comment on the possible biological relevance of sequence-dependent charge transfer in DNA
Work :
We find that random and λ-DNA have localization lengths allowing for electron motion among a few dozen basepairs only.
Technical :
We study the electronic properties of DNA by way of a tight-binding model applied to four particular DNA sequences. The charge transfer properties are presented in terms of localization lengths (crudely speaking, the length over which electrons travel.
Education :
Electronic, DNA sequence
Now I want to extract paragraph with heading "Technical" with my code I can extract particular paragraph between two heading, but cannot extract all paragraph with similar headings.
with open("aks.txt") as infile, open("fffm",'w') as outfile:
copy = False
for line in infile:
if line.strip() == "Technical":
copy = True
elif line.strip() == "Work":
copy = False
elif copy:
outfile.write(line)
fh = open("fffm.txt", 'r')
contents = fh.read()
len(contents)