How Can I Get Only Heading Names.from The Text File
I have a Text file as below: Education: askdjbnakjfbuisbrkjsbvxcnbvfiuregifuksbkvjb.iasgiufdsegiyvskjdfbsldfgd Technical skills : java,j2ee etc., work done: oaugafiuadgkfjw
Solution 1:
To get just the headings from your text file, you could use the follows:
import re
withopen('aks.txt') as f_input:
headings = re.findall(r'(.*?)\s*:', f_input.read())
print headings
This would display the following:
['Education', 'Technical skills', 'work done']
Post a Comment for "How Can I Get Only Heading Names.from The Text File"