Here's my entry.
Python:
Code:import re f = open('bhaarat.text').read() # Search for sequences containing one or more numbers, # then a full stop, then white-space, then words beginning # with H and S. sh = re.compile(r'\d+.\s(H\D+|S\D+)') list = sh.findall(f) out = open('out.text', 'w') a = len(list) while a > 0: list.insert(a-1,'. ') list.insert(a-1,str(a),) a = a - 1 b = "".join(list) out.write(b) out.close bh = open('bhaarat.text', 'a') bh.write('23. English\n') bh.close()
Bookmarks