Материал из Википедии — свободной энциклопедии
# -*- coding: UTF-8 -*-
__version__='$Id:'
import wikipedia
import re, sys
import codecs
def vivod(b):
# wikipedia.output(b)
otch.write(b)
otch.flush()
def main(g1,g2,fvih,fviha):
f1=codecs.open(fvih, 'w', 'utf-8')
f1a=codecs.open(fviha, 'w', 'utf-8')
g=g1
while g<=g2:
b=((u'Kategorio:%d-a jarcento a.K.\n[[Kategorio:jarcentoj]]\n\n'+
u'[[de:Kategorie:%d. Jahrhundert v. Chr.]]\n'+
u'[[en:Category:%dth century BC]]\n'+
u'[[fi:Luokka:%d-luku eaa]]\n'+
u'[[no:Kategori:%d-tallet f.Kr.]]\n'+
u'========\n')%(g,g,g,(g-1)*100,(g-1)*100))
f1.write(b)
f1.flush()
b=((u'%d-a jarcento a.K.\n?=======\n1\n-=======\n+=======\n\n'+
u'[[Kategorio:%d-a jarcento a.K.]]\n'+
u'============\n')%(g,g))
f1a.write(b)
f1a.flush()
g+=1
if __name__ == "__main__":
try:
g1=int(wikipedia.argHandler(sys.argv[1], 'perevod'))
g2=int(wikipedia.argHandler(sys.argv[2], 'perevod'))
fvih = wikipedia.argHandler(sys.argv[3], 'perevod')
fviha = wikipedia.argHandler(sys.argv[4], 'perevod')
# fotch = wikipedia.argHandler(sys.argv[3], 'perevod')
# otch = codecs.open(fotch, 'w', 'utf-8')
#otch2 = codecs.open(fotch2, 'w', 'utf-8')
main(g1,g2,fvih,fviha)
finally:
wikipedia.stopme()