November 10, 2020

Wikipedia Documentation

(последний раз использовал 15.10.2018)

Wikipedia is a Python library that makes it easy to access and parse data from Wikipedia.

Получение текст из вики!

install wikipedia *

cmd / py setup.py install/

install numpy **

cmd / py or python [ok comand]

pip install numpy-1.14.6+mkl-cp27-cp27m-win32.whl

ЗАМЕЧАНИЕ! ТОЛЬКО ТАМ ГДЕ PIP ЗАПУСКАТЬ cmd

python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
> > > import wikipedia
> > > wikipedia.set_lang("ru")
> > > taj = wikipedia.summary("Tajikistan")
> > > print("taj")
>>> import wikipedia
>>> print wikipedia.summary("Wikipedia")
# Wikipedia (/ˌwɪkɨˈpiːdiə/ or /ˌwɪkiˈpiːdiə/ WIK-i-PEE-dee-ə) is a collaboratively edited, multilingual, free Internet encyclopedia supported by the non-profit Wikimedia Foundation...

>>> wikipedia.search("Barack")
# [u'Barak (given name)', u'Barack Obama', u'Barack (brandy)', u'Presidency of Barack Obama', u'Family of Barack Obama', u'First inauguration of Barack Obama', u'Barack Obama presidential campaign, 2008', u'Barack Obama, Sr.', u'Barack Obama citizenship conspiracy theories', u'Presidential transition of Barack Obama']

>>> ny = wikipedia.page("New York")
>>> ny.title
# u'New York'
>>> ny.url
# u'http://en.wikipedia.org/wiki/New_York'
>>> ny.content
# u'New York is a state in the Northeastern region of the United States. New York is the 27th-most exten'...
>>> ny.links[0]
# u'1790 United States Census'

>>> wikipedia.set_lang("fr")
>>> wikipedia.summary("Facebook", sentences=1)
# Facebook est un service de réseautage social en ligne sur Internet permettant d'y publier des informations (photographies, liens, textes, etc.) en contrôlant leur visibilité par différentes catégories de personnes.

*https://github.com/goldsmith/Wikipedia

** https://www.scipy.org/install.html

help numpy

https://habr.com/post/352678/
https://pythonworld.ru/numpy/3.html
https://stackoverflow.com/questions/11200137/installing-numpy-on-64bit-windows-7-with-python-2-7-3

Просто бомба! оставлю здесь, полезная ссылка именно API то что надо:)

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

https://python-scripts.com/work-with-files-python