Secondary sandbox. Hey I needed another one. Ya gotta a problem with that? add as round 4
I'm running these tests to see
Here is a bit of garbage text. (part one) let's add something here, this was added round one. removed a some from below too.
Some people say that sleep is overrated.
And here we have some more wonderful text written by the most fantastic Leftmost. (part two) most fantastic what, I want to know!
Some people say that food is overrated but I think they must be working for the dietary industry. But maybe they are working in the back of McD's and they know how bad the food is.
Here is yet a bit more garbage text. (part three)
Clearly those people are nuts.
#!/usr/bin/python # -*- coding: utf-8 -*- import sys, re fin = sys.stdin page_tag = re.compile('<page>') title_content = re.compile('<title>(+):(.+)<\/title>') title_tag = re.compile('<title>') title_capture = re.compile('<title>(.*)<\/title>') page_tag_end = re.compile('<\/page>') pagnm=re.compile('\'\'\'\{\{PAGENAME\}\}\'\'\'') pagnm2=re.compile('\{\{ξεν\|zh\|\{\{PAGENAME\}\}\}\}') eof=0 check_blanks=0 trans_found=0 while not eof: line = fin.readline() if line == "": eof = 1 elif page_tag.search(line): namespace="" title="" transl="" check_blanks=0 trans_found=0 elif title_tag.search(line): result = title_content.search(line) if result: namespace=result.group(1) title=result.group(2) else: result = title_capture.search(line) if result: namespace="main" title=result.group(1) elif pagnm.search(line) or pagnm2.search(line): check_blanks=1 elif check_blanks==1: if line == '\n': continue else: transl=line check_blanks=0 trans_found=1 elif page_tag_end.search(line): if trans_found: print "]: %s" % (title, transl) check_blanks=0 trans_found=0 fin.close()