Thank everybody for all your answers, I think that I should be able to
achieve my goal using your advice. 

Le dimanche 01 décembre 2013 à 21:26 +0100, Merlijn van Deen a écrit :
> On 1 December 2013 11:38, Amir Ladsgroup <ladsgr...@gmail.com> wrote:
> 
> > 2- use readlines:
> > import codecs
> > site=wikipedia.getSite()
> > f=codecs.open("file.txt","r","utf-8")
> > for line in f.readlines():
> >     line=line.replace("\n","").replace("\r","")
> >     name=line.split(":")[0] #or any kind that you like to get the title
> >     page=wikipedia.Page(site,name)
> >     #do whatever you like with the page
> >
> 
> You can read the file per-line using 'for line in f' -- this will just read
> the current line in memory. Cleaning up the rest a bit results in:
> 
> import codecs, wikipedia # or pywikibot if you are using core
> site = wikipedia.getSite() # or pywikibot.Site() if you are using core
> f = codecs.open("file.txt", "r", "utf-8")
> for line in f:
>     line = line.strip()
>     name, definition = line.split(":", 1)
>     page = wikipedia.Page(site, name)
>     page.put(definition) # probably something else, though.
> 
> 
> If you need some more assistance, I'd suggest joining #pywikipediabot on
> irc.freenode.net -- it's typically quicker than e-mail :-)
> 
> Merlijn
> _______________________________________________
> Wikitech-l mailing list
> Wikitech-l@lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l


_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to