Hey, welcome back!
You'll be happy to know that you can use python to know about any topic related to your research from wikipedia.
#import module
import requests
import pandas as pd
from bs4 import BeautifulSoup
def getdata(url):
r=requests.get(url)
return r.text
htmldata=getdata("https://en.wikipedia.org/wiki/Artificial_Intelligence")
soup= BeautifulSoup(htmldata, 'html.parser')
data=''
for data in soup.find_all("p"):
print(data.get_text())
Here is the output of the code.
You can use the same code for acquiring various kind of information just by doing a slight change.
htmldata=getdata("https://en.wikipedia.org/wiki/(#Entering the topic name")
Assume, you want to know about solar eclipse, here is the code for it. Observe the slight change in it.
#import module
import requests
import pandas as pd
from bs4 import BeautifulSoup
def getdata(url):
r=requests.get(url)
return r.text
htmldata=getdata("https://en.wikipedia.org/wiki/Solar_Eclipse")
soup= BeautifulSoup(htmldata, 'html.parser')
data=''
for data in soup.find_all("p"):
print(data.get_text())
Similarly, you get information regarding any topic.
For doubts or feedback you can send us a mail or comment below.
Comments
Post a Comment