Getting Information From Wikipedia Using Python

 



Basic Information:

What you will need:

  • IDLE or Any IDE With Python
  • Python interpreter<2.7
  • pip Package Installed or Anaconda
  • Internet Connection

What i Was Using:

  • PyCharm 
  • Anaconda 

How To Do It?

So first we need to install a package that we use , called as wikipedia( no surprise ). We do that by opening CMD or command prompt and running -

pip install wikipedia

This process should take a min. After thats done we can get to actually coding

Open up your favorite IDE and first import the package

import wikipedia

now we input from user, what they want to search about and how many lines of information they want

query = input(”What Do You Want to Search for?”)

n = int(input(”Enter No of lines ”)

After we get this, we use a method of the library we imported called summary and since python is object oriented we will use ‘ . ‘ followed by method. We save that information to a variable and print it out

Code below!!!







Hope you all liked it ! 

Follow @load_thecode on Instagram 

Do Like and Share


Comments

Post a Comment