I need that when the user enters "what is ......", the program would copy the definition from Wikipedia, and display it on the screen. If necessary, you can use different libraries and languages.
Closed due to the fact that off-topic participants Enikeyschik , Akina , Air , aleksandr barakin , Regent 27 Dec '18 at 6:52 .
It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:
- " Learning tasks are allowed as questions only on the condition that you tried to solve them yourself before asking a question . Please edit the question and indicate what caused you difficulties in solving the problem. For example, give the code you wrote, trying to solve the problem "- Enikeyschik, Akina, Air, aleksandr barakin
- fourThis is not a problem solving point on request. Need - do, have any questions - ask - RiotBr3aker
- The question is how to copy definitions from Wikipedia and assign them to any variable. - Eugene Tolstov
- oneThis is a question from the category of "write the code for me", have you ever tried to write something yourself? Well, if you worked at least a little on the Python web, then at least you should be able to work with the API of sites or, as a last resort, how to get the bare text of the html page, and get the necessary text from it, here’s how to find the definition in such a text is a more or less valid question, and so you just want someone to write you a program. - RiotBr3aker
- I wanted to find out how this is done in general, because I have not worked with the web on a python before - Evgeny Tolstov
- 2Then IMHO you took on the task that was too overwhelming and you should start by reading the articles and, possibly, the courses, but not with "how do I write the code?". - RiotBr3aker
|
1 answer
I shall confine myself, perhaps, to general recommendations on the algorithm for obtaining data from Wikipedia.
you do
import requestsandfrom bs4 import BeautifulSoup.You receive the page through
requests.get().You enter the answer in
BeautifulSoupand by means offind()you find what you need.
PS Please note that bs4 is not included in the standard Python set, it should be installed separately via pip .
- then you can immediately pip install wikipedia and continue not to bathe at all. This is python :) - nick_gabpe
- @nick_gabpe and such is ??))) did not know .. thanks, I will consider)) maybe it will be useful where - Captain Flint
|