Wikipedia disambiguation error

后端 未结 3 1435
独厮守ぢ
独厮守ぢ 2021-01-15 05:09

I have recently been using the wikipedia module to determine a random wikipedia page.

I have been doing this with a very large list of words, and the random.choice()

3条回答
  •  醉梦人生
    2021-01-15 05:55

    Better yet, use the tool at your disposal :

    wikipedia.random(pages=1)
    
    Get a list of random Wikipedia article titles.
    
    Note
    
    Random only gets articles from namespace 0, meaning no Category, User talk, or other meta-Wikipedia pages.
    
    Keyword arguments:
    
        pages - the number of random pages returned (max of 10)
    

    (from https://wikipedia.readthedocs.io/en/latest/code.html#api)

提交回复
热议问题