Advertisement
Guest User

UnroBot

a guest
Sep 1st, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. import sys, pprint, re
  3. sys.path.append('C:\pywikipedia')
  4. import wikipedia, pagegenerators
  5.  
  6. def main(pag):
  7.     #site = wikipedia.getSite()
  8.     #pag = wikipedia.Page(site, pag)
  9.     text = pag.get().splitlines()
  10.     count = 0
  11.     for i in text:
  12.         if i.startswith('|'):
  13.             text[count] = re.sub(r'[|] ?(.*?) *?= ?(.*?)', r'|\1 = \2', i)
  14.         count += 1
  15.     pag.put('\n'.join(text), comment=u'Bot: Reemplaçament automàtic d\'espais (+/-)')  
  16.    
  17. if __name__ == '__main__':
  18.     gen = pagegenerators.AllpagesPageGenerator(start='El Masnou', namespace=0, includeredirects=False)
  19.     for i in gen:
  20.         main(i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement