Re: [Wikitech-l] [Pywikipediabot] Using the content of a file as input for articles

2013-12-02 Thread Mathieu Stumpf
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

[Wikitech-l] [Pywikipediabot] Using the content of a file as input for articles

2013-12-01 Thread Mathieu Stumpf
Hello, I want to add esperanto words to fr.wiktionary using as input a file where each line have the format word:the fine definition. So I copied the basic.py, and started hacking it to achieve my goal. Now, it's seems like the -file argument expect a file where each line is formated as

Re: [Wikitech-l] [Pywikipediabot] Using the content of a file as input for articles

2013-12-01 Thread Amir Ladsgroup
you have several options 1-use regex e.g.: import re, codecs site=wikipedia.getSite() f=codecs.open(file.txt,r,utf-8) R=re.compile(\{\{(.+?)\}\}) #or other types of regex for name in R.findall(f.read()): page=wikipedia.Page(site,name) #do whatever you like with the page 2- use

Re: [Wikitech-l] [Pywikipediabot] Using the content of a file as input for articles

2013-12-01 Thread Marcin Cieslak
Mathieu Stumpf psychosl...@culture-libre.org wrote: Hello, I want to add esperanto words to fr.wiktionary using as input a file where each line have the format word:the fine definition. So I copied the basic.py, and started hacking it to achieve my goal. Now, it's seems like the -file

Re: [Wikitech-l] [Pywikipediabot] Using the content of a file as input for articles

2013-12-01 Thread Merlijn van Deen
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

Re: [Wikitech-l] [Pywikipediabot] Using the content of a file as input for articles

2013-12-01 Thread Marcin Cieslak
Mathieu Stumpf psychosl...@culture-libre.org wrote: Hello, I want to add esperanto words to fr.wiktionary using as input a file where each line have the format word:the fine definition. So I copied the basic.py, and started hacking it to achieve my goal. Now, it's seems like the -file