python wiki question

ruud habets otw67 at xs4all.nl
Fri Nov 10 05:10:48 EST 2006


ruud habets schreef:
> Hi,
> 
> Does anybody know how to determine if a wiki page is a redirectpage 
> using the wikipedia-scripts? It must be something like
> 
> if IsRedirectPage() == False:
>    text_file.write("\n")
> 
> But I cannot seem to get it working.
> 
> thnx
> Ruud
problem solved:

def workon(page):
     try:
         text = page.get()
     except wikipedia.IsRedirectPage:
         return

     text_file.write(page.title().encode("utf-8"))
     text_file.write("\n")
     text_file.write(page.get().encode("utf-8"))
     text_file.write("\n")
     print page

thnx anyway
ruud



More information about the Python-list mailing list