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
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
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
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
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
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