From Wikipedia, the free encyclopedia
import re
import subprocess
rawfilename="00CFDdeletes.txt"
fi=open(rawfilename,'r')
regex=re.compile(r".*[Cc]ategory:(?P<oldcat>.*)$")
cfdregex=re.compile(r".*Wikipedia:Categories for discussion/Log/(?P<dat>.*)$")
CFDbase="-summary:\"Wikipedia:Categories for discussion/Working\": "
for line in fi:
cfdd=cfdregex.findall(line)
if cfdd:
print
CFDbase="-summary:\"Wikipedia:Categories for discussion/Log/"+cfdd[0]+"\""
print "******* SETTING CFD page to: Wikipedia:Categories for deletion/Log/" + cfdd[0]
print
print
m=regex.findall(line)
if m:
oldcat= m[0]
print
print "\t\t", m[0]
print
print "DELETING <"+oldcat+"> !!!!"
fromarg="-from:"+str(oldcat)
summary = CFDbase + " removing:" + oldcat
l=["python","category.py","-putthrottle:2", "-batch",summary, "remove", fromarg]
subprocess.call(l)
fromarg2=fromarg.replace(" ","_")
l=["python","category.py", "-putthrottle:2", "-batch", summary, "remove", fromarg2]
subprocess.call(l)
fi.close()