Skip to main content

Use Python to know about Artificial Intelligence

 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.
python, know information using python, wikipedia, pythonbeginners, python learners, python coding, programming
Let's check the code.

    #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.

python, know information using python, wikipedia, pythonbeginners, python learners, python coding, programming



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())
python, know information using python, wikipedia, pythonbeginners, python learners, python coding, programming

Similarly, you get information regarding any topic.
For doubts or feedback you can send us a mail or comment below.

Stay Tuned for more such posts!







Comments

Popular posts from this blog

Know the current Covid status of your country using Python!

 We all are aware about COVID-19, i.e. coronavirus infectious disease 2019.  Isn't it fascinating, using python for numerous purpose! So, here is the python program that can help you know the status of COVID-19 of your country. -------------------------------------------------------------------------------------------------------------------------- For this you need to install one package using the pip command. pip install covid -------------------------------------------------------------------------------------------------------------------------- from covid import Covid covid=Covid() cases=covid.get_status_by_country_name("India") #enter the name of the country you want to know the status for x in cases:     print(x,":",cases[x]) -------------------------------------------------------------------------------------------------------------------------- Output of the above program, giving current status is: id : 80 country : India confirmed : 9857029 active : 35...

Drawing a star with stamp of turtle in python!

  Here is the code for the same: import   turtle star = turtle . Turtle () star. color ( "pink" ) star. shape ( "turtle" ) wn = turtle . Screen () wn. bgcolor ( "black" ) for  i  in   range ( 100 ):     star. forward ( 200 + 20 * i)     star. stamp ()     star. right ( 144 ) turtle . speed ( 9 ) turtle .done() Output of the above code: 

Snakes and Ladders Game!

 Hey! Welcome back to my blog!  In this blog we will learn to create our one of the favorite childhood game "SNAKES AND LADDERS". I hope everyone is aware about this game. I still remember I used to play this game during my summer vacation and perhaps those were the best days.  Okay, let's start python coding for the same game! So for this particular piece of code, I have assumed the following game board and according to that numbers are assigned to the snakes and ladders. --------------------------------------------------------------------------------------------------------------- from PIL import Image import random end=100 def show_board():     img=Image.open('C:\\Users\\asus01\\Desktop\\slb.jpg')     img.show() def check_ladder(points):         if points==3:             print("Ladder")             return 51         elif points==6:     ...